diff options
author | Mark Mitchell <mark@markmitchell.com> | 1998-12-02 10:12:20 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1998-12-02 10:12:20 +0000 |
commit | 066b4a1cc8da79e2ff195d3f154de68577a76c14 (patch) | |
tree | a12aa702427dd1f4bdfa449696a3ad3c2512152f /gcc | |
parent | b7f7462b7a23b0e5465e66f1738f3caf22a38b65 (diff) | |
download | gcc-066b4a1cc8da79e2ff195d3f154de68577a76c14.zip gcc-066b4a1cc8da79e2ff195d3f154de68577a76c14.tar.gz gcc-066b4a1cc8da79e2ff195d3f154de68577a76c14.tar.bz2 |
decl2.c (validate_nonmember_using_decl): Complain about using declarations for class members.
* decl2.c (validate_nonmember_using_decl): Complain about using
declarations for class members.
From-SVN: r24060
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.ns/using11.C | 9 |
3 files changed, 24 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3cfe701..336e694 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +1998-12-02 Mark Mitchell <mark@markmitchell.com> + + * decl2.c (validate_nonmember_using_decl): Complain about using + declarations for class members. + 1998-11-29 Jason Merrill <jason@yorick.cygnus.com> * typeck2.c (process_init_constructor): Use same_type_p. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index e57a6af..cf9df28 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -4690,6 +4690,16 @@ validate_nonmember_using_decl (decl, scope, name) { *scope = TREE_OPERAND (decl, 0); *name = TREE_OPERAND (decl, 1); + + /* [namespace.udecl] + + A using-declaration for a class member shall be a + member-declaration. */ + if (TREE_CODE (*scope) != NAMESPACE_DECL) + { + cp_error ("`%D' is not a namespace", *scope); + return NULL_TREE; + } } else if (TREE_CODE (decl) == IDENTIFIER_NODE || TREE_CODE (decl) == TYPE_DECL diff --git a/gcc/testsuite/g++.old-deja/g++.ns/using11.C b/gcc/testsuite/g++.old-deja/g++.ns/using11.C new file mode 100644 index 0000000..23943f2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ns/using11.C @@ -0,0 +1,9 @@ +// Build don't link: + +class joey { +public: + typedef int SVec; +}; + +using joey::SVec; // ERROR - joey is not a namespace + |