https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96162
--- Comment #1 from Haoxin Tu <haoxintu at gmail dot com> ---
Add a more case.
$cat p.cc
#include <iostream>
int a() {
for (static int & b) {}
}
$g++ p.cc
test.cc: In function ‘int a()’:
test.cc:3:24: error: expected ‘;’ before ‘)’ token
3 | for (static int & b) {}
| ^
| ;
test.cc:3:24: error: expected primary-expression before ‘)’ token
test.cc:3:24: error: expected ‘;’ before ‘)’ token
3 | for (static int & b) {}
| ^
| ;
during GIMPLE pass: *build_cgraph_edges
test.cc:3:23: internal compiler error: in discriminator_for_local_entity, at
cp/mangle.c:1910
3 | for (static int & b) {}
| ^
0x63316d discriminator_for_local_entity
../../gcc/cp/mangle.c:1910
This time GCC emits "during GIMPLE pass: *build_cgraph_edges" first and then
triggers the ICE.