https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94924
Bug ID: 94924 Summary: Default equality operator for C-array compares addresses, not data Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rhalbersma at gmail dot com Target Milestone: --- It appears that the default op== for a C-array has array-to-pointer decay applied and does not compare the underlying array data. struct S { int data[1]; bool operator==(const S&) const = default; }; int main() { static_assert(S{1} != S{1}); constexpr auto s = S{1}; static_assert(s == s); } Tested on tip-of-trunk at Wandbox: https://wandbox.org/permlink/YxUv5dFs7mSGlNBx Works correctly on Clang >= 10.