https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122112
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Jason Merrill <[email protected]>: https://gcc.gnu.org/g:806d5417e0c04a15c48a7e876ebf435f06ecfccc commit r16-4209-g806d5417e0c04a15c48a7e876ebf435f06ecfccc Author: Egas Ribeiro <[email protected]> Date: Fri Oct 3 01:56:52 2025 +0100 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. Signed-off-by: Egas Ribeiro <[email protected]>
