summaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-26 18:09:02 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-26 18:09:02 +0000
commit3ef0a05e848ce72b6d5224893e94ed790980c463 (patch)
tree0a295d469e667b407d72e2be5dc3b6409999416f /gcc/attribs.c
parentc7e846b42c69d950c4e5a6de2503e949bb8bcbda (diff)
downloadgcc-3ef0a05e848ce72b6d5224893e94ed790980c463.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132681 138bc75d-0d04-0410-961f-82ee72b054a4
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 31b92cad508..767035b5dd1 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