summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-30 18:27:18 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-30 18:27:18 +0000
commitb484ac95a67e8b09f4359864dcdaee2f9f5a9e1d (patch)
treef145502b2b806e9b4059928ba67c8e1cd2579c77
parenta08295badb386cf0e543b33ba8836d6fd3904a0f (diff)
downloadppe42-gcc-b484ac95a67e8b09f4359864dcdaee2f9f5a9e1d.tar.gz
ppe42-gcc-b484ac95a67e8b09f4359864dcdaee2f9f5a9e1d.zip
PR c++/18698
* decl2.c (grokfield): Only try to treat the decl as an access declaration if the scope is a class. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115095 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/testsuite/g++.dg/parse/access10.C13
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c9eb4b9d7d4..ad5b0553f28 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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-29 Jason Merrill <jason@redhat.com>
PR c++/26905
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 0a12a380658..620141ac0b0 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -769,6 +769,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
index 00000000000..4142f15b22c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/access10.C
@@ -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 }
OpenPOWER on IntegriCloud