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

            Bug ID: 123601
           Summary: [16 Regression] ICE in build_min_non_dep_op_overload,
                    at cp/tree.cc:3850
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jirehguo at tju dot edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/xcWPcTzjr
The following c++ code crash gcc trunk.
But gcc 12,13,14,15 with checking is fine.

Code:
```cpp
#include <compare>
struct D {
  auto operator<=>(int x) const { return 1; }
};
template <class T> void f() {
  D d{42};
  int d1 = 42;
  assert(is_eq(d1 <=> d));
}
```

Stack dump:
```
<source>: In function 'void f()':
<source>:8:23: internal compiler error: in build_min_non_dep_op_overload, at
cp/tree.cc:3850
    8 |   assert(is_eq(d1 <=> d));
      |                       ^
0x292a498 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x291f25b internal_error(char const*, ...)
        ???:0
0xb1670c fancy_abort(char const*, int, char const*)
        ???:0
0xe22b00 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ???:0
0xd58163 c_parse_file()
        ???:0
0xec9d69 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.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

Reply via email to