diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-12-16 10:08:43 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-12-16 10:08:43 +0000 |
commit | a0c68737027348fb9ae1ff4a5a33a10d269962bb (patch) | |
tree | cdb6bff3438c48d90d9bc3062e8e3f8e2f8a81f6 /gcc/cp/cp-lang.c | |
parent | 0f30f285e44b335cef60431f418bda986f47df35 (diff) | |
download | gcc-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/cp-lang.c')
-rw-r--r-- | gcc/cp/cp-lang.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 92e6b91..fdb1404 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -296,6 +296,11 @@ ok_to_generate_alias_set_for_type (tree t) static HOST_WIDE_INT cxx_get_alias_set (tree t) { + if (CLASS_TYPE_P (t) && TYPE_CONTEXT (t) && CLASS_TYPE_P (TYPE_CONTEXT (t)) + && CLASSTYPE_AS_BASE (TYPE_CONTEXT (t)) == t) + /* The base variant of a type must be in the same alias set as the + complete type. */ + t = TYPE_CONTEXT (t); if (/* It's not yet safe to use alias sets for some classes in C++. */ !ok_to_generate_alias_set_for_type (t) |