Created on 2025-10-14.00:00:00 last changed 1 month ago
Proposed resolution (approved by CWG 2025-11-04):
Change in 7.7 [expr.const] paragraph 26 as follows:
An immediate-escalating function is
- the call operator of a lambda that is not declared with the consteval specifier,
- a defaulted special member function that is not declared with the consteval specifier, or
- a function that is not a prospective destructor and that results from the instantiation of a templated entity defined with the constexpr specifier.
(From submission #780.)
Consider:
consteval void undefined();
template <typename T>
struct scope_exit {
T t;
constexpr ~scope_exit() { t(); } // #2
};
scope_exit guard([]() {
undefined(); // # 1
});
#1 is an immediate escalating expression (because undefined is not defined) and ~scope_exit() is instantiated from a constexpr templated entity #2, thus is immediate escalating. Finally, this causes ~scope_exit to be an immediate function.
However, destructors cannot be consteval.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-07 22:16:49 | admin | set | status: tentatively ready -> ready |
| 2025-11-05 12:07:23 | admin | set | messages: + msg8215 |
| 2025-11-05 12:07:23 | admin | set | status: open -> tentatively ready |
| 2025-10-14 00:00:00 | admin | create | |