From e410303f768fa7b020e46f3bd7d28381144e5340 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 8 Dec 2023 15:55:49 -0500 Subject: [PATCH 01/11] c++: trait patch tweak To: gcc-patches@gcc.gnu.org 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 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 9e76426566b..b987324f669 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -20164,22 +20164,22 @@ cp_parser_simple_type_specifier (cp_parser* parser, return type; default: + /* 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; + } + 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); - - return type; - } - /* If token is an already-parsed decltype not followed by ::, it's a simple-type-specifier. */ if (token->type == CPP_DECLTYPE -- 2.39.3