https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123340
Bug ID: 123340
Summary: tree check: expected tree that contains 'typed'
structure, have 'static_assert' in
type_dependent_expression_p, at cp/pt.cc
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: 522024330006 at smail dot nju.edu.cn
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/o9jcTz436
The compiler crashed when a Statement Expression and a static_assert that
depends on a Template Parameter Pack combined.
Program:
```c
template <typename... Ts>
void foo() {
({ static_assert(sizeof...(Ts) == 0, ""); });
}
```
Backtrace:
```
internal compiler error: tree check: expected tree that contains 'typed'
structure, have 'static_assert' in type_dependent_expression_p, at
cp/pt.cc:29641
3 | ({ static_assert(sizeof...(Ts) == 0, ""); });
| ^
0x290fae8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29048ab internal_error(char const*, ...)
???:0
0xa182b0 tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
???:0
0xdd29b7 finish_expr_stmt(tree_node*)
???:0
0xd52ed3 c_parse_file()
???:0
0xec4909 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
```