https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102213
Bug ID: 102213 Summary: Incorrect executable produced from valid input code with virtual consteval Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: fchelnokov at gmail dot com Target Milestone: --- Consider the program ``` #include <compare> struct A { virtual consteval std::strong_ordering operator <=>(const A &) const = default; }; struct B : A { virtual consteval bool operator==(const A&) const noexcept override { return false; } }; int main() { static constexpr B b; static constexpr const A & a = b; static_assert( (a <=> a) == 0 ); static_assert( a != a ); return (a <=> a) == 0; } ``` It shall return 1, but after making in GCC it fails with return code 139: https://gcc.godbolt.org/z/EjdWa61W9