https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116297

            Bug ID: 116297
           Summary: ICE on using default spaceship comparison operator
                    inside requires
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Building of this valid program (accepted in Clang and MSVC)
```
#include <compare>

int main() {
    struct A {
        auto operator<=>(const A &) const = default;
        void f() {
            static_assert( requires { A{} <=> A{}; } );
        }
    };
}
```
results in

internal compiler error: in maybe_push_to_top_level, at cp/name-lookup.cc:8679
    7 |             static_assert( requires { A{} <=> A{}; } );
      |                                                 ^
0x202ef4c internal_error(char const*, ...)
        ???:0
0x778915 fancy_abort(char const*, int, char const*)
        ???:0
0x86b86e synthesize_method(tree_node*)
        ???:0
0x8331be mark_used(tree_node*, int)
        ???:0
0x7a50e0 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ???:0
0x98a7a2 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ???:0
0x90e414 c_parse_file()
        ???:0
0xa0c4d9 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.

Online demo: https://gcc.godbolt.org/z/Ko5911fPh

Reply via email to