aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2002-03-12 23:32:47 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2002-03-12 23:32:47 +0000
commitdf867456d79fcb8d136e9e64e6caff4435eb5ca7 (patch)
tree43e771810125bfcb9dfe317ea9f8984be22db3a4 /gcc/cp/decl2.c
parent35bb2beeac02c760aac69d0eff9605bf9c2f2204 (diff)
downloadgcc-df867456d79fcb8d136e9e64e6caff4435eb5ca7.zip
gcc-df867456d79fcb8d136e9e64e6caff4435eb5ca7.tar.gz
gcc-df867456d79fcb8d136e9e64e6caff4435eb5ca7.tar.bz2
re PR c++/5659 (default access for class/struct bug)
cp: PR c++/5659 * decl.c (xref_tag): Don't set CLASSTYPE_DECLARED_CLASS here. * decl2.c (handle_class_head): Set CLASSTYPE_DECLARED_CLASS for definitions. testsuite: * g++.dg/other/access1.C: New test. From-SVN: r50692
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 71dc388..8841dec 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -5252,7 +5252,13 @@ handle_class_head (aggr, scope, id, defn_p, new_type_p)
&& TREE_CODE (context) != BOUND_TEMPLATE_TEMPLATE_PARM);
if (*new_type_p)
push_scope (context);
-
+
+ if (TREE_CODE (TREE_TYPE (decl)) == RECORD_TYPE)
+ /* It is legal to define a class with a different class key,
+ and this changes the default member access. */
+ CLASSTYPE_DECLARED_CLASS (TREE_TYPE (decl))
+ = aggr == class_type_node;
+
if (!xrefd_p && PROCESSING_REAL_TEMPLATE_DECL_P ())
decl = push_template_decl (decl);
}