[Bug c++/119259] compilation error: *constexpr* operator==(const T&) const = default` forces compilation of std::vector<not std::equality_comparable>'s operator== function

ppalka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 13 02:59:17 GMT 2025


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

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Defaulted special member functions seem similarly affected. The following
should be valid in C++23 mode after P2448R2:

struct A { A(); };

struct B {
  A a;
  constexpr B() = default;
};

<stdin>:5:13: error: explicitly defaulted function ‘constexpr B::B()’ cannot be
declared ‘constexpr’ because the implicit declaration is not ‘constexpr’:
<stdin>:1:12: note: defaulted constructor calls non-‘constexpr’ ‘A::A()’
<stdin>:1:12: note: ‘A::A()’ declared here


More information about the Gcc-bugs mailing list