On 1/22/26 1:03 AM, Jakub Jelinek wrote:
On Wed, Jan 21, 2026 at 01:37:32PM +0100, Jakub Jelinek wrote:
It can be also a defaulted comparison operator function.
And that is currently not immediate-escalating:
https://eel.is/c++draft/expr.const#25.2

I wonder too if they shouldn't be immediate-escalating; shall that
a defaulted special member function that is not declared with the consteval 
specifier, or
change s/special member/ or s/function/& or a comparison operator function/

Dropping "special member" makes sense to me.

struct S {
   decltype (^^::) s = ^^::;
   bool operator== (const S &) const = default;
};

And dunno if:
struct T {
   decltype (^^::) t = ^^::;
   friend bool operator== (const T &, const T &);
};
bool operator== (const T &, const T &) = default;
would then be valid or not (the in-class declaration is not consteval
and is not immediate-escalating, but the defaulted one later on would be).

I guess it's ill-formed because the in-class declaration is not consteval. Which seems fine; the reason to default a function after its initial declaration is for linkage, which is meaningless for an immediate function.

Though, if we request a CWG to change this (shall I do that or will you?), we
need to also change the immediate_escalating_function_p function and add
test coverage for that (though guess that is desirable anyway even if it is
not immediate-escalating to test that we error on that).

I will.

Jason

Reply via email to