On Wed, Jan 21, 2026 at 08:15:14PM +0800, Jason Merrill wrote:
> > -  check_consteval_only_fn (decl);
> > +  /* Don't call check_consteval_only_fn for defaulted special member
> > +     functions.  Those are immediate-escalating functions but at this point
> > +     DECL_DEFAULTED_P has not been set.  */
> > +  if (initialized != SD_DEFAULTED || special_memfn_p (decl) == sfk_none)
> 
> I don't think we need to check special_memfn_p, other functions can't be
> defaulted (and if they could they'd probably also be immediate-escalating).

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/
?

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).

        Jakub

Reply via email to