https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106668
Bug ID: 106668
Summary: ICE: friend function in struct declaration in generic
lambda
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jeanmichael.celerier at gmail dot com
Target Milestone: ---
Repro: foo.cpp
void foo();
bool ok = [] (auto x) {
struct y {
friend void foo();
};
return 0;
}(0);
build:
$ g++ foo.cpp
<source>: In instantiation of '<lambda(auto:1)> [with auto:1 = int]':
<source>:7:6: required from here
<source>:3:14: internal compiler error: Segmentation fault
3 | struct y {
| ^
0x1ba65f9 internal_error(char const*, ...)
???:0
0x878158 instantiate_decl(tree_node*, bool, bool)
???:0
0x8936ab instantiate_pending_templates(int)
???:0
0x79c46d c_parse_final_cleanups()
???: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.
ASM generation compiler returned: 1
<source>: In instantiation of '<lambda(auto:1)> [with auto:1 = int]':
<source>:7:6: required from here
<source>:3:14: internal compiler error: Segmentation fault
3 | struct y {
| ^
0x1ba65f9 internal_error(char const*, ...)
???:0
0x878158 instantiate_decl(tree_node*, bool, bool)
???:0
0x8936ab instantiate_pending_templates(int)
???:0
0x79c46d c_parse_final_cleanups()
???:0
It fails in c++14, 17 and 20 modes