-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Consider
consteval void undefined();
template <typename T>
struct scope_exit {
T t;
constexpr ~scope_exit() { t(); } // #2
};
scope_exit guard([]() {
undefined(); // # 1
});
Here,
#1
is an immediate escalating espression (undefined
is not defined)~scope_exit()
is immediately escalating ( "a function that results from the instantiation of a templated entity defined with the constexpr specifier"
This causes scope_exit<lambda-type>::~scope_exit
to be an immediate function.
However, destructors cannot be consteval, we don't really know what that would mean, so it seems undesirable to allow them to be immediate functions through escalation.
Proposed change
An immediate-escalating function is
(26.1)
the call operator of a lambda that is not declared with the consteval specifier,
(26.2)
a defaulted special member function that is not declared with the consteval specifier, or
(26.3)
a function that is not a destructor or a prospective destructor and that results from the instantiation of a templated entity defined with the constexpr specifier.
Metadata
Metadata
Assignees
Labels
No labels