https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123595
Bug ID: 123595
Summary: [16 Regression] ICE in cp_parser_expression_statement,
at cp/parser.cc:14015
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/addME546a
The following invalid c++ code crash gcc trunk.
GCC 13,14,15 with checking is fine.
Code:
```cpp
template <typename T> class A {
public:
T data;
template <typename U> void set(U *value) {
data = reinterpret_cast<T *>(value);
}
};
template <auto = [] {
struct B {};
A<B> a;
a.set(new B());
}>
```
Stack dump:
```
<source>: In lambda function:
<source>:12:16: internal compiler error: in cp_parser_expression_statement, at
cp/parser.cc:14016
12 | a.set(new B());
| ^
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
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
```