https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97882
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |msebor at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- While testing a fix for this I came up with the following variation on the original test case: void f (void) { auto enum E g (); // valid? unsigned g () { } } This also ICEs but I'm not sure if it should be fixed the same way as the original or rather by rejecting the auto storage specifier on nested function declarations. Since nested functions are implicitly static the auto is in conflict with that, the same way extern is below. Shouldn't the auto be rejected? (There are tests that expect this to be valid, e.g., gcc.dg/nested-func-3.c.) $ cat t.c && /build/gcc-trunk/gcc/cc1 t.c void f (void) { extern enum E g (); unsigned g () { } } f g t.c:4:12: error: static declaration of ‘g’ follows non-static declaration 4 | unsigned g () { } | ^ t.c:3:17: note: previous declaration of ‘g’ was here 3 | extern enum E g (); | ^ t.c: In function ‘g’: t.c:4:3: internal compiler error: Segmentation fault 4 | unsigned g () { } | ^~~~~~~~ 0x13f321a crash_signal /src/gcc/trunk/gcc/toplev.c:327 0xbdc3b4 must_pass_in_stack_var_size_or_pad(function_arg_info const&) /src/gcc/trunk/gcc/calls.c:6282