From e410303f768fa7b020e46f3bd7d28381144e5340 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Dec 2023 15:55:49 -0500 Subject: 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. --- gcc/cp/parser.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 9e76426..b987324 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 ::, -- cgit v1.1