Open
Description
This C++20 program
#include <compare>
struct A {
friend constexpr auto operator<=>(const A &, const A &) = default;
};
constexpr bool operator ==(const A &, const A &) noexcept;
static_assert( ((bool(*)(const A &, const A &))&operator==)( A{}, A{} ) );
is accepted in GCC and Clang 18.1, but the current Clang trunk rejects it with the error
<source>:9:16: error: static assertion expression is not an integral constant expression
9 | static_assert( ((bool(*)(const A &, const A &))&operator==)( A{}, A{} ) );
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>:9:16: note: undefined function 'operator==' cannot be used in a constant expression
<source>:4:27: note: declared here
4 | friend constexpr auto operator<=>(const A &, const A &) = default;
| ^
Online demo: https://gcc.godbolt.org/z/ssqxsoYac