https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123404

            Bug ID: 123404
           Summary: consteval keyword shouldn't be needed for defaulted
                    special members of consteval-only type
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

struct S {
  decltype (^^::) a = ^^::;
  consteval S () {}
  S (const S &) = default;
  S (S &&) = default;
  S &operator= (const S &) = default;
  S &operator= (S &&) = default;
  consteval const char *what () { return "what"; }
};

consteval
{
  S s;
  S t;
  t = s;
  S u = t;
  u.what ();
}

is rejected on the reflection branch, eventhough:
https://cplusplus.github.io/CWG/issues/3115.html
says that an immediate function is also
https://eel.is/c++draft/expr.const#26.2
an immediate-escalating function whose type is consteval-only
and
https://eel.is/c++draft/expr.const#25.2
says that an immediate-escalating function is also
a defaulted special member function that is not declared with the consteval
specifier

While in case of what I think consteval keyword is required because it is not
immediate-escalating.  So, https://cplusplus.github.io/LWG/lwg-active.html#4494
in current wording may be NAD, but the important part (what consteval in 2
spots instead of constexpr) is missing.

Reply via email to