diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2012-10-25 16:14:59 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2012-10-25 16:14:59 +0000 |
commit | 42b40eff8019d80a429d26616e80db96f1cb882c (patch) | |
tree | 64f3e00ee1e86736bdb2e4f38aaf2db7d77e5611 /gcc/cp | |
parent | f14edc1af5f9149d913221f39dc96980d7ac73a2 (diff) | |
download | gcc-42b40eff8019d80a429d26616e80db96f1cb882c.zip gcc-42b40eff8019d80a429d26616e80db96f1cb882c.tar.gz gcc-42b40eff8019d80a429d26616e80db96f1cb882c.tar.bz2 |
re PR c++/53761 (ICE on incorrect transparent union (first field has floating point type))
/cp
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53761
* class.c (finish_struct_1): Reject aggregates decorated with
__transparent_union__ which cannot be made transparent because
the type of the first field has a different ABI from the class
overall.
/testsuite
2012-10-25 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/53761
* g++.dg/ext/transparent-union.C: New.
From-SVN: r192814
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/class.c | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 458f39a..3cd3b27 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2012-10-25 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/53761 + * class.c (finish_struct_1): Reject aggregates decorated with + __transparent_union__ which cannot be made transparent because + the type of the first field has a different ABI from the class + overall. + 2012-10-25 Jason Merrill <jason@redhat.com> Core 1402 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 3e1b44a..e55f1f9 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -6267,7 +6267,7 @@ finish_struct_1 (tree t) tree field = first_field (t); if (field == NULL_TREE || error_operand_p (field)) { - error ("type transparent class %qT does not have any fields", t); + error ("type transparent %q#T does not have any fields", t); TYPE_TRANSPARENT_AGGR (t) = 0; } else if (DECL_ARTIFICIAL (field)) @@ -6281,6 +6281,13 @@ finish_struct_1 (tree t) } TYPE_TRANSPARENT_AGGR (t) = 0; } + else if (TYPE_MODE (t) != DECL_MODE (field)) + { + error ("type transparent %q#T cannot be made transparent because " + "the type of the first field has a different ABI from the " + "class overall", t); + TYPE_TRANSPARENT_AGGR (t) = 0; + } } } |