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

--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Jakub Jelinek from comment #6)
> This boils down to
> struct S {
>   unsigned int s;
>   S () : s (0) {}
>   constexpr S &operator= (const S &) = default;
> };
> i.e. when the default ctor is not constexpr, but defaulted assignment
> operator is constexpr.

A simpler test case is this:

$ more bug1101.cc

struct S {
  S();
  constexpr S & operator=( const S & ) = default;
};

foundBugs $ ~/gcc/results/bin/g++ -c bug1101.cc
foundBugs $ ~/llvm/results/bin/clang++ -c bug1101.cc
bug1101.cc:4:3: error: defaulted definition of copy assignment operator cannot
be marked constexpr before C++23
    4 |   constexpr S & operator=( const S & ) = default;
      |   ^
1 error generated.
foundBugs $ 

Some compiler disagreement there. Perhaps g++ is already at C++23 ?

> I have no idea which compiler is right here, 

Nor do I, but this has drifted from cobol to C++. 
Should I write a new bug report ?

Reply via email to