https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106212
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-07-06 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to fiesh from comment #1) > Oh and this appears to be a regression introduced in GCC 12. Seems to be a library change in GCC 12 which triggers a pre-existing compiler bug. This fails with all versions of GCC -std=c++20 but compiles with clang -std=c++20 and EDG --c++20 namespace std { using size_t = decltype(sizeof(0)); template<typename _Tp, size_t _Nm> struct array { _Tp _M_elems[_Nm]; constexpr const _Tp* data() const noexcept { return _M_elems; } }; template<typename _Tp> constexpr bool __check_singular(_Tp* const& __ptr) { return __ptr == 0; } template<typename _Tp, size_t _Nm> constexpr bool operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two) { if (__check_singular(__one.data())) throw 1; return &__one == &__two; } } struct P { constexpr P(int i) : e{i} {} bool operator==(P const &) const = default; std::array<int, 1> e; }; constexpr auto operator-(P lhs, P) { return lhs; } constexpr P p{1}, q{0}; static_assert(p - q != 0);