aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2008-02-26 13:09:02 -0500
committerJason Merrill <jason@gcc.gnu.org>2008-02-26 13:09:02 -0500
commit317c435f413d27d35d8abcfb7ee40dc4f3167f53 (patch)
tree0a295d469e667b407d72e2be5dc3b6409999416f /gcc/attribs.c
parentf82c41ea91a0cf691c9a59ca9219e63933c0d9fb (diff)
downloadgcc-317c435f413d27d35d8abcfb7ee40dc4f3167f53.zip
gcc-317c435f413d27d35d8abcfb7ee40dc4f3167f53.tar.gz
gcc-317c435f413d27d35d8abcfb7ee40dc4f3167f53.tar.bz2
re PR c++/35315 (ICE with attribute transparent_union)
PR c++/35315 * attribs.c (decl_attributes): Leave ATTR_FLAG_TYPE_IN_PLACE alone if it's the naming decl for the type's main variant. * cp/decl.c (grokdeclarator): Allow a typedef of an unnamed struct to name the struct for linkage purposes even if it has attributes. (start_decl): In that case, set ATTR_FLAG_TYPE_IN_PLACE. From-SVN: r132681
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index 31b92ca..767035b 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -280,7 +280,11 @@ decl_attributes (tree *node, tree attributes, int flags)
if (spec->type_required && DECL_P (*anode))
{
anode = &TREE_TYPE (*anode);
- flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
+ /* Allow ATTR_FLAG_TYPE_IN_PLACE for the type's naming decl. */
+ if (!(TREE_CODE (*anode) == TYPE_DECL
+ && *anode == TYPE_NAME (TYPE_MAIN_VARIANT
+ (TREE_TYPE (*anode)))))
+ flags &= ~(int) ATTR_FLAG_TYPE_IN_PLACE;
}
if (spec->function_type_required && TREE_CODE (*anode) != FUNCTION_TYPE