From: Jason Merrill Date: Fri, 18 Mar 2011 15:06:41 +0000 (-0400) Subject: re PR c++/35315 (ICE with attribute transparent_union) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=82d3711899283500f82e917649cd3dc0457ba1a1;p=gcc.git re PR c++/35315 (ICE with attribute transparent_union) PR c++/35315 * c-common.c (handle_transparent_union_attribute): Don't make a duplicate type in C++. From-SVN: r171145 --- diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a0268fd5b5b..ca3db25b1cb 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2011-03-18 Jason Merrill + + PR c++/35315 + * c-common.c (handle_transparent_union_attribute): Don't + make a duplicate type in C++. + 2011-03-15 Jason Merrill * c-common.c (max_constexpr_depth): New. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 6674c58ffab..799f8154936 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6152,6 +6152,7 @@ handle_transparent_union_attribute (tree *node, tree name, if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) { if (TYPE_FIELDS (type) == NULL_TREE + || c_dialect_cxx () || TYPE_MODE (type) != DECL_MODE (TYPE_FIELDS (type))) goto ignored; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ac7e5ad62af..dcd19eadd26 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-18 Jason Merrill + + * g++.dg/ext/attrib32.C: Expect errors on the two-names case. + 2011-03-18 Rainer Orth PR middle-end/47405 diff --git a/gcc/testsuite/g++.dg/ext/attrib32.C b/gcc/testsuite/g++.dg/ext/attrib32.C index 77f71ded89d..e4dfe4e9f67 100644 --- a/gcc/testsuite/g++.dg/ext/attrib32.C +++ b/gcc/testsuite/g++.dg/ext/attrib32.C @@ -10,10 +10,10 @@ void bar() foo(0); } -typedef union U1 { int i; } U2 __attribute__((transparent_union)); +typedef union U1 { int i; } U2 __attribute__((transparent_union)); // { dg-warning "ignored" } -static void foo2(U1) {} -static void foo2(U2) {} +static void foo2(U1) {} // { dg-error "previously defined" } +static void foo2(U2) {} // { dg-error "redefinition" } void bar2(U1 u1, U2 u2) {