]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: trait patch tweak
authorJason Merrill <jason@redhat.com>
Fri, 8 Dec 2023 20:55:49 +0000 (15:55 -0500)
committerJason Merrill <jason@redhat.com>
Sun, 10 Dec 2023 18:11:22 +0000 (13:11 -0500)
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

index 9e76426566b10f80d7b2e37d26e9aee8e06b9b99..b987324f6691a5c90d48be3704693e6a32a26ae7 100644 (file)
@@ -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 ::,