* parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant error.
authorJason Merrill <jason@redhat.com>
Fri, 23 Aug 2019 23:29:10 +0000 (19:29 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 23 Aug 2019 23:29:10 +0000 (19:29 -0400)
From-SVN: r274893

gcc/cp/ChangeLog
gcc/cp/parser.c

index 8eebf894f45bd8d7d1411a314df78417e215acc4..06437559480c1754a28fabfc7abd38b445d77bb8 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-22  Jason Merrill  <jason@redhat.com>
+
+       * parser.c (cp_parser_nested_name_specifier_opt): Avoid redundant
+       error.
+
 2019-08-23  Marek Polacek  <polacek@redhat.com>
 
        PR c++/91521 - wrong error with operator->.
index 535147875548baa52f1c08838cfa43ce118254f0..382575320de53f89a6a1cd7c41acc8b104372421 100644 (file)
@@ -6420,9 +6420,11 @@ cp_parser_nested_name_specifier_opt (cp_parser *parser,
                  == CPP_SCOPE))
            {
              token = cp_lexer_consume_token (parser->lexer);
-             error_at (token->location, "%<decltype%> evaluates to %qT, "
-                       "which is not a class or enumeration type",
-                       token->u.tree_check_value->value);
+             tree dtype = token->u.tree_check_value->value;
+             if (dtype != error_mark_node)
+               error_at (token->location, "%<decltype%> evaluates to %qT, "
+                         "which is not a class or enumeration type",
+                         dtype);
              parser->scope = error_mark_node;
              error_p = true;
              /* As below.  */