https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116428
Bug ID: 116428
Summary: Redeclaration of explicitly defaulted comparison
operator makes it undefined
Product: gcc
Version: 14.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
This program
```
struct A {
friend constexpr bool operator ==(const A &, const A &) noexcept = default;
};
constexpr bool operator ==(const A &, const A &) noexcept;
static_assert( A{} == A{} );
```
looks valid and it is accepted by EDG compiler. But GCC rejects it with the
error
> inline function 'constexpr bool operator==(const A&, const A&)' used but
> never defined
Clang unfortunately has a similar issue.
Online demo: https://gcc.godbolt.org/z/f5saeGrGM
Related discussion: https://stackoverflow.com/q/78889523/7325599