https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93480
Will Wray <wjwray at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wjwray at gmail dot com --- Comment #1 from Will Wray <wjwray at gmail dot com> --- I'm keen to see this fixed (and open to contribute) (defaulted array comparison now works on Clang & MSVC). Workaround for lack of compiler-generated array<=>array is awkward and brittle: https://godbolt.org/z/xr668E * Preprocessor conditional compilation is required (at least there seems no way to detect array<=>array support and dispatch to a user-defined comparison only as needed - iff array members are present): # if ! defined(__GNUC__) || defined(__clang__) auto operator<=>(C const&) const = default; # else constexpr auto operator<=>(C const& r) const { return three_way_compare(x,r.x); } #endif Then: * A generic 3-way comparison for array should be recursive. * Achieving efficient/vector codegen is not straightforward. * Deducing the return type is subtle: template <typename E, int N> constexpr auto three_way_compare(E const(&l)[N], E const(&r)[N]) { auto c = l[0] <=> r[0]; for (int i = 0; ++i != N; c = l[i] <=> r[i]) if (c != 0) return c; return c; } So it'd be better for all if this were compiler-generated.