https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123550
Bug ID: 123550
Summary: [16 Regression] ICE in maybe_push_to_top_level, at
cp/name-lookup.cc:8983
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/Yo58EdbKx
The following c++ code crash gcc trunk with -std=c++20 flag.
But do not crash gcc 13,14,15 with checking.
Code:
```cpp
template <auto = +[] {
struct LocalType {
auto operator<=>(const LocalType &other) const = default;
};
constexpr LocalType a, b;
static_assert(noexcept(a <=> b), "Noexcept check failed");
}
```
Stack dump:
```
<source>: In lambda function:
<source>:6:34: internal compiler error: in maybe_push_to_top_level, at
cp/name-lookup.cc:8983
6 | static_assert(noexcept(a <=> b), "Noexcept check failed");
| ^
0x2926688 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x291b44b internal_error(char const*, ...)
???:0
0xb16d54 fancy_abort(char const*, int, char const*)
???:0
0xc7f99e synthesize_method(tree_node*)
???:0
0xc2e504 mark_used(tree_node*, int)
???:0
0xb52d5a build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
???:0
0xe21c12 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
???:0
0xd57563 c_parse_file()
???:0
0xec8ee9 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
```