PR c++/84820 - no error for invalid qualified-id.
authorJason Merrill <jason@redhat.com>
Thu, 15 Mar 2018 04:34:45 +0000 (00:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 15 Mar 2018 04:34:45 +0000 (00:34 -0400)
* parser.c (cp_parser_make_indirect_declarator): Don't wrap
cp_error_declarator.

From-SVN: r258549

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/parse/error21.C
gcc/testsuite/g++.dg/parse/qualified5.C [new file with mode: 0644]

index 4a526b9b3a055f50bd1daa66e6b9701c0d4a145d..dc7708ba499e447f5127dcecbb7fbc76a89f857b 100644 (file)
@@ -1,5 +1,9 @@
 2018-03-14  Jason Merrill  <jason@redhat.com>
 
+       PR c++/84820 - no error for invalid qualified-id.
+       * parser.c (cp_parser_make_indirect_declarator): Don't wrap
+       cp_error_declarator.
+
        PR c++/84801 - ICE with unexpanded pack in lambda.
        * pt.c (check_for_bare_parameter_packs): Don't return early for a
        lambda in non-template context.
index 0a82f415196c3b77b7984540a9e6d44ee6e2d8c3..119f6c078f73e14573b51f3c62c8f9f55a40921f 100644 (file)
@@ -3823,7 +3823,7 @@ cp_parser_make_indirect_declarator (enum tree_code code, tree class_type,
                                    cp_declarator *target,
                                    tree attributes)
 {
-  if (code == ERROR_MARK)
+  if (code == ERROR_MARK || target == cp_error_declarator)
     return cp_error_declarator;
 
   if (code == INDIRECT_REF)
index 8c717d7e81113473faf13ac6ebcc6ae0eb2bc926..920a4909e15580c36ea310ab0c88361b8960b8f3 100644 (file)
@@ -8,6 +8,5 @@ void foo()
   // Check that we do not complain about an unused
   // compiler-generated variable.
   A& = a; // { dg-error "6:expected unqualified-id before '=' token" "6" }
-  // { dg-error "8:'a' was not declared in this scope" "8" { target *-*-* } .-1 }
 }
 
diff --git a/gcc/testsuite/g++.dg/parse/qualified5.C b/gcc/testsuite/g++.dg/parse/qualified5.C
new file mode 100644 (file)
index 0000000..dff934e
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/84820
+
+struct A {};
+
+template<int> struct B : A
+{
+  B()
+  {
+    A(&A::foo);                        // { dg-error "foo" }
+  }
+};
+
+B<0> b;