aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-12-16 10:08:43 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-12-16 10:08:43 +0000
commita0c68737027348fb9ae1ff4a5a33a10d269962bb (patch)
treecdb6bff3438c48d90d9bc3062e8e3f8e2f8a81f6 /gcc/cp/class.c
parent0f30f285e44b335cef60431f418bda986f47df35 (diff)
downloadgcc-a0c68737027348fb9ae1ff4a5a33a10d269962bb.zip
gcc-a0c68737027348fb9ae1ff4a5a33a10d269962bb.tar.gz
gcc-a0c68737027348fb9ae1ff4a5a33a10d269962bb.tar.bz2
re PR c++/13387 (assignment to base class corrupts subclass)
cp: PR c++/13387 * class.c (finish_struct_1): Compute mode and alias set for CLASSTYPE_AS_BASE. * call.c (build_over_call): Use CLASSTYPE_AS_BASE for trivial assignment of a class, as necessary. * cp-lang.c (cxx_get_alias_set): The alias set as a base is the same as for the complete type. testsuite: PR c++/13387 * g++.dg/expr/assign1.C: New test. From-SVN: r74683
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 55e9797..19b5ce6 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -5052,6 +5052,10 @@ finish_struct_1 (tree t)
/* Layout the class itself. */
layout_class_type (t, &virtuals);
+ if (CLASSTYPE_AS_BASE (t) != t)
+ /* We use the base type for trivial assignments, and hence it
+ needs a mode. */
+ compute_record_mode (CLASSTYPE_AS_BASE (t));
/* Make sure that we get our own copy of the vfield FIELD_DECL. */
vfield = TYPE_VFIELD (t);