]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/18698 (Error message using "using" for code not using "using" ;-))
authorJason Merrill <jason@redhat.com>
Fri, 30 Jun 2006 19:45:54 +0000 (15:45 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 30 Jun 2006 19:45:54 +0000 (15:45 -0400)
        PR c++/18698
        * decl2.c (grokfield): Only try to treat the decl as an access
        declaration if the scope is a class.

From-SVN: r115102

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

index 997bb1c1ef32dc259189dd7906777fa9615675c5..402f39a063f90804a488c9e02b11261f9c8d6e1f 100644 (file)
@@ -1,3 +1,9 @@
+2006-06-30  Jason Merrill  <jason@redhat.com>
+
+       PR c++/18698
+       * decl2.c (grokfield): Only try to treat the decl as an access 
+       declaration if the scope is a class.
+
 2006-06-28  Jason Merrill  <jason@redhat.com>
 
        PR c++/27424
index f7c6675cf4794e36b8e00cc1b8a40c24826c23bb..7aa7af9b13025b071ec8a6b691a1ddc90847b26d 100644 (file)
@@ -830,6 +830,8 @@ grokfield (const cp_declarator *declarator,
   if (!declspecs->any_specifiers_p
       && declarator->kind == cdk_id
       && declarator->u.id.qualifying_scope 
+      && TYPE_P (declarator->u.id.qualifying_scope)
+      && IS_AGGR_TYPE (declarator->u.id.qualifying_scope)
       && TREE_CODE (declarator->u.id.unqualified_name) == IDENTIFIER_NODE)
     /* Access declaration */
     return do_class_using_decl (declarator->u.id.qualifying_scope,
diff --git a/gcc/testsuite/g++.dg/parse/access10.C b/gcc/testsuite/g++.dg/parse/access10.C
new file mode 100644 (file)
index 0000000..4142f15
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/18698
+// The compiler was giving an error message for invalid syntax
+// that irrelevantly talked about using-declarations.
+
+template<int> struct A
+{
+    ::A~();                    // { dg-bogus "using-declaration" }
+};
+
+// Instead of the bogus error we get 3 separate errors.
+// { dg-error "no type" "" { target *-*-* } 5 }
+// { dg-error "::" "" { target *-*-* } 5 }
+// { dg-error "~" "" { target *-*-* } 5 }