This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH for c++/14587
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Apr 2004 18:25:34 -0400
- Subject: PATCH for c++/14587
I just noticed that I hadn't checked this patch into the trunk yet, though
it was extensively discussed in the PR and part of it is in 3.4.0.
Tested athlon-pc-linux-gnu, applied to trunk. Danny Smith also tested the
patch on cygwin.
2004-04-30 Jason Merrill <jason@redhat.com>
PR c++/14587
* config/i386/winnt.c (associated_type): Look for attributes on
the TYPE_MAIN_VARIANT of *this.
* attribs.c (decl_attributes): If ATTR_FLAG_TYPE_IN_PLACE, also
apply the attributes to the variants.
*** attribs.c.~1~ 2004-04-30 14:53:34.000000000 -0400
--- attribs.c 2004-04-30 18:22:53.000000000 -0400
*************** decl_attributes (tree *node, tree attrib
*** 294,300 ****
if (DECL_P (*anode))
DECL_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs);
else if (flags & (int) ATTR_FLAG_TYPE_IN_PLACE)
! TYPE_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs);
else
*anode = build_type_attribute_variant (*anode,
tree_cons (name, args,
--- 294,319 ----
if (DECL_P (*anode))
DECL_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs);
else if (flags & (int) ATTR_FLAG_TYPE_IN_PLACE)
! {
! TYPE_ATTRIBUTES (*anode) = tree_cons (name, args, old_attrs);
! /* If this is the main variant, also push the attributes
! out to the other variants. */
! if (*anode == TYPE_MAIN_VARIANT (*anode))
! {
! tree variant;
! for (variant = *anode; variant;
! variant = TYPE_NEXT_VARIANT (variant))
! {
! if (TYPE_ATTRIBUTES (variant) == old_attrs)
! TYPE_ATTRIBUTES (variant)
! = TYPE_ATTRIBUTES (*anode);
! else if (!lookup_attribute
! (spec->name, TYPE_ATTRIBUTES (variant)))
! TYPE_ATTRIBUTES (variant) = tree_cons
! (name, args, TYPE_ATTRIBUTES (variant));
! }
! }
! }
else
*anode = build_type_attribute_variant (*anode,
tree_cons (name, args,
*** config/i386/winnt.c.~1~ 2004-04-30 14:53:34.000000000 -0400
--- config/i386/winnt.c 2004-04-30 14:52:54.000000000 -0400
*************** associated_type (tree decl)
*** 171,177 ****
dtor's are not affected by class status but virtual and
non-virtual thunks are. */
if (!DECL_ARTIFICIAL (decl) || DECL_COMDAT (decl))
! t = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl))));
}
else if (DECL_CONTEXT (decl)
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
--- 171,178 ----
dtor's are not affected by class status but virtual and
non-virtual thunks are. */
if (!DECL_ARTIFICIAL (decl) || DECL_COMDAT (decl))
! t = TYPE_MAIN_VARIANT
! (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
}
else if (DECL_CONTEXT (decl)
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')