https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123485
Bug ID: 123485
Summary: ICE: Segmentation fault signal terminated program
cc1plus in cxx_init_decl_processing when using lambda
with __typeof__
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: ---
It is specifically reproducible with the flag -std=c++20 or later.
To reproduce: https://godbolt.org/z/KPPaKWcMP
Similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121390
Program:
```c
int f() {
return [](__typeof__([]{})) {}();
}
```
I use gdb to get this stack dump:
```
"/workspace/install/gcc/src/gcc/gcc/attribs.cc: decl_attributes: 904",
"/workspace/install/gcc/src/gcc/gcc/langhooks.cc: build_builtin_function: 742",
"/workspace/install/gcc/src/gcc/gcc/langhooks.cc: add_builtin_function: 759",
"/workspace/install/gcc/src/gcc/gcc/c-family/c-common.cc: def_builtin_1: 5078",
"/workspace/install/gcc/src/gcc/gcc/builtins.def: c_define_builtins: 993",
"/workspace/install/gcc/src/gcc/gcc/c-family/c-common.cc:
c_common_nodes_and_builtins: 4833",
"/workspace/install/gcc/src/gcc/gcc/cp/decl.cc: cxx_init_decl_processing:
5038",
"/workspace/install/gcc/src/gcc/gcc/cp/lex.cc: cxx_init: 369",
"/workspace/install/gcc/src/gcc/gcc/toplev.cc: lang_dependent_init: 1895",
"/workspace/install/gcc/src/gcc/gcc/toplev.cc: do_compile: 2193",
"/workspace/install/gcc/src/gcc/gcc/toplev.cc: toplev::main: 2371",
"/workspace/install/gcc/src/gcc/gcc/main.cc: main: 39"
```