aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2002-03-02 19:51:57 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2002-03-02 19:51:57 +0000
commitfd87b7a7099bc82b2542b169c592c0dfc997029e (patch)
treefed3e389d12d8ef87e63a352e8dfcd37659de11a /gcc/cp/decl.c
parent4f647d52ec4534ff30bdb0729217ffd8ee899010 (diff)
downloadgcc-fd87b7a7099bc82b2542b169c592c0dfc997029e.zip
gcc-fd87b7a7099bc82b2542b169c592c0dfc997029e.tar.gz
gcc-fd87b7a7099bc82b2542b169c592c0dfc997029e.tar.bz2
re PR c++/775 (2.97 error declaring nested class a friend)
cp: PR c++/775 * decl.c (lookup_tag): Only reject enum/class mismatch, not class/union mismatch. * parse.y (check_class_key): New function. (structsp): Call it.Read from remote host gcc.gnu.org: Connection reset by peer testsuite: * g++.dg/other/classkey1.C: New test. From-SVN: r50230
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d4ea80d..854a2c2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5345,7 +5345,7 @@ lookup_tag (form, name, binding_level, thislevel_only)
if (old && DECL_ORIGINAL_TYPE (TYPE_NAME (old)))
old = NULL_TREE;
if (old && TREE_CODE (old) != form
- && !(form != ENUMERAL_TYPE && TREE_CODE (old) == TEMPLATE_DECL))
+ && (form == ENUMERAL_TYPE || TREE_CODE (old) == ENUMERAL_TYPE))
{
error ("`%#D' redeclared as %C", old, form);
return NULL_TREE;
@@ -5361,14 +5361,12 @@ lookup_tag (form, name, binding_level, thislevel_only)
if (TREE_PURPOSE (tail) == name)
{
enum tree_code code = TREE_CODE (TREE_VALUE (tail));
- /* Should tighten this up; it'll probably permit
- UNION_TYPE and a struct template, for example. */
+
if (code != form
- && !(form != ENUMERAL_TYPE && code == TEMPLATE_DECL))
+ && (form == ENUMERAL_TYPE || code == ENUMERAL_TYPE))
{
/* Definition isn't the kind we were looking for. */
- error ("`%#D' redeclared as %C", TREE_VALUE (tail),
- form);
+ error ("`%#D' redeclared as %C", TREE_VALUE (tail), form);
return NULL_TREE;
}
return TREE_VALUE (tail);