https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123568
Bug ID: 123568
Summary: ICE in cp_lexer_new_from_tokens, at cp/parser.cc:964
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/9KTqse4MM
The following invliad c++ code crash gcc trunk without any flag.
And goes back to 12.1 with checking using -std=c++23 flag.
The 12.1 does not crash without -std=c++23 flag.
Code:
```cpp
struct {
a<[] {
struct {
int b = ;
}
}>
}
```
Stack dump:
```
<source>: In lambda function:
<source>:5:6: error: expected ';' after struct definition
5 | }
| ^
| ;
<source>:5:5: error: abstract declarator '<unnamed
struct>::<lambda()>::<unnamed struct>' used as declaration
5 | }
| ^
<source>: At global scope:
<source>:2:3: error: 'a' does not name a type
2 | a<[] {
| ^
<source>:7:2: error: expected ';' after struct definition
7 | }
| ^
| ;
<source>:7:1: internal compiler error: in cp_lexer_new_from_tokens, at
cp/parser.cc:964
7 | }
| ^
0x2924328 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x29190eb internal_error(char const*, ...)
???:0
0xb1632c fancy_abort(char const*, int, char const*)
???:0
0xd56dd3 c_parse_file()
???:0
0xec8829 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
```