https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94058
Bug ID: 94058 Summary: defaulted three way comparison operator defined as deleted when a member is a small bitfield of long type. Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: okannen at gmail dot com Target Milestone: --- Version: GCC 10.0.1 20200229 Exemple of code: #include <compare> struct A{ long i : 48; auto operator <=> (const A&) const = default; }; struct B{ long i : 8; auto operator <=> (const B&) const = default; }; void f(A a, B b){ a <=> a; //OK b <=> b; //error (see bellow) } Error message: <source>: In function 'void f(A, B)': <source>:15:11: error: use of deleted function 'constexpr auto B::operator<=>(const B&) const' 15 | b <=> b; | ^ <source>:10:10: note: 'constexpr auto B::operator<=>(const B&) const' is implicitly deleted because the default definition would be ill-formed: 10 | auto operator <=> (const B&) const = default; | ^~~~~~~~ <source>:10:10: warning: narrowing conversion of '((const B*)this)->B::i' from 'long int' to 'int' [-Wnarrowing] <source>:10:10: warning: narrowing conversion of '<anonymous>.B::i' from 'long int' to 'int' [-Wnarrowing] Compiler returned: 1