From: Jason Merrill Date: Fri, 8 Dec 2023 20:55:49 +0000 (-0500) Subject: c++: trait patch tweak X-Git-Tag: basepoints/gcc-15~3770 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e410303f768fa7b020e46f3bd7d28381144e5340;p=thirdparty%2Fgcc.git c++: trait patch tweak As Patrick suggested elsewhere, let's move this into the default case. gcc/cp/ChangeLog: * parser.cc (cp_parser_simple_type_specifier): Move trait handling to default label. --- diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 9e76426566b1..b987324f6691 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -20164,20 +20164,20 @@ cp_parser_simple_type_specifier (cp_parser* parser, return type; default: - break; - } + /* If token is a type-yielding built-in traits, parse it. */ + const cp_trait* trait = cp_lexer_peek_trait_type (parser->lexer); + if (trait) + { + type = cp_parser_trait (parser, trait); + if (decl_specs) + cp_parser_set_decl_spec_type (decl_specs, type, + token, + /*type_definition_p=*/false); - /* If token is a type-yielding built-in traits, parse it. */ - const cp_trait* trait = cp_lexer_peek_trait_type (parser->lexer); - if (trait) - { - type = cp_parser_trait (parser, trait); - if (decl_specs) - cp_parser_set_decl_spec_type (decl_specs, type, - token, - /*type_definition_p=*/false); + return type; + } - return type; + break; } /* If token is an already-parsed decltype not followed by ::,