aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-08-12 13:48:30 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-08-12 13:48:30 +0000
commit05008fb97d0b9316c8c4a453d6fbd3948c869442 (patch)
tree9e619c71660b183ef6cb90715c81fb534630312c
parent23a05d03eb62690cb29bf7fb4d6e719d62a2135d (diff)
downloadgcc-05008fb97d0b9316c8c4a453d6fbd3948c869442.zip
gcc-05008fb97d0b9316c8c4a453d6fbd3948c869442.tar.gz
gcc-05008fb97d0b9316c8c4a453d6fbd3948c869442.tar.bz2
decl.c (grokdeclarator): Issue errors on namespace qualified declarators in parameter lists or in class...
1998-08-12 Mark Mitchell <mark@markmitchell.com> * decl.c (grokdeclarator): Issue errors on namespace qualified declarators in parameter lists or in class scope. From-SVN: r21684
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/decl.c8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ns/bogus1.C10
3 files changed, 22 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a84a1a9..fe7813b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+1998-08-12 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (grokdeclarator): Issue errors on namespace qualified
+ declarators in parameter lists or in class scope.
+
1998-08-09 Mark Mitchell <mark@markmitchell.com>
* pt.c (check_explicit_specialization): Don't abort on bogus
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1b70a1b..1fa4abf 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10125,7 +10125,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == PARM)
{
- if (ctype)
+ if (ctype || in_namespace)
error ("cannot use `::' in parameter declaration");
/* A parameter declared as an array of T is really a pointer to T.
@@ -10179,6 +10179,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
are error_mark_node, for example. */
decl = NULL_TREE;
}
+ else if (in_namespace)
+ {
+ /* Something like struct S { int N::j; }; */
+ cp_error ("invalid use of `::'");
+ decl = NULL_TREE;
+ }
else if (TREE_CODE (type) == FUNCTION_TYPE)
{
int publicp = 0;
diff --git a/gcc/testsuite/g++.old-deja/g++.ns/bogus1.C b/gcc/testsuite/g++.old-deja/g++.ns/bogus1.C
new file mode 100644
index 0000000..c61dea8
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.ns/bogus1.C
@@ -0,0 +1,10 @@
+// Build don't link:
+
+namespace N {}
+
+void f(int N::k); // ERROR - cannot use `::' in parameter declaration
+
+class Foo
+{
+ int N::j; // ERROR - invalid use of `::'
+};