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
This commit is contained in:
Mark Mitchell 1998-08-12 13:48:30 +00:00 committed by Mark Mitchell
parent 23a05d03eb
commit 05008fb97d
3 changed files with 22 additions and 1 deletions

View File

@ -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> 1998-08-09 Mark Mitchell <mark@markmitchell.com>
* pt.c (check_explicit_specialization): Don't abort on bogus * pt.c (check_explicit_specialization): Don't abort on bogus

View File

@ -10125,7 +10125,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
if (decl_context == PARM) if (decl_context == PARM)
{ {
if (ctype) if (ctype || in_namespace)
error ("cannot use `::' in parameter declaration"); error ("cannot use `::' in parameter declaration");
/* A parameter declared as an array of T is really a pointer to T. /* 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. */ are error_mark_node, for example. */
decl = NULL_TREE; 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) else if (TREE_CODE (type) == FUNCTION_TYPE)
{ {
int publicp = 0; int publicp = 0;

View File

@ -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 `::'
};