c++: Fix ICE with struct in function parameter containing auto [PR122112]
When parsing function parameters containing a struct declaration,
initially auto_is_implicit_function_template_parm_p is set to true by
cp_parser_parameter_declaration_clause. However, later when we enter
class scope and scope_kind becomes sk_class, we don't set it to false, so
cp_parser_simple_type_specifier will call
synthesize_implicit_template_parm, which expects that
current_binding_level->kind == sk_function_parms, triggering a failed
assertion. This fix ensures that auto_is_implicit_function_template_parm_p
isn't set when parsing a struct body definition.
gcc/cp/ChangeLog:
PR c++/122112
* parser.cc (cp_parser_parameter_declaration_clause): Don't
enable auto_is_implicit_function_template_parm_p when entering
class scope.
gcc/testsuite/ChangeLog:
PR c++/122112
* g++.dg/parse/auto-struct-param.C: New test.