https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93479
Bug ID: 93479 Summary: compare_three_way allows comparing arrays Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: barry.revzin at gmail dot com Target Milestone: --- This program: #include <compare> bool check(int(&x)[4], int(&y)[4]) { return std::compare_three_way{}(x, y) == 0; } Successfully compiles, with check() doing an address comparison on x and y. But compare_three_way is just the function object for <=> and x <=> y is ill-formed (gcc correctly rejects that). The check for __3way_builtin_ptr_cmp needs to reject arrays, since the expression declval<T>() <=> declval<U>() does not resolve to a built-in operator comparing pointers (it doesn't resolve to any operator).