re PR c++/14587 (Multiple inheriance/DLL testcase (g++.dg/ext/dllexport-MI1.C) failures)
authorJason Merrill <jason@redhat.com>
Fri, 30 Apr 2004 22:26:48 +0000 (18:26 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 30 Apr 2004 22:26:48 +0000 (18:26 -0400)
        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.

From-SVN: r81369

gcc/ChangeLog
gcc/attribs.c
gcc/config/i386/winnt.c

index b24e85876fba84fbb46f4c389d490a2d006a5e9d..311728e4d551f03b3ef0a47a92c66f4ece92bf78 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2004-04-30  Paul Brook  <paul@codesourcery.com>
 
        * config.gcc: Simplify arm --with-{cpu,tune} test.
index 5d8450ff6018a0204ef9098e57ccfa4e5f9d5a28..671528ccacd2f2390f8ce26e2b736c64618c1292 100644 (file)
@@ -294,7 +294,26 @@ decl_attributes (tree *node, tree attributes, int flags)
              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);
+               {
+                 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,
index b97810a67edc90500a03cc631e8170b3901d41eb..6196d32aa6f21f4a20a35831bee71439ad472689 100644 (file)
@@ -171,7 +171,8 @@ associated_type (tree decl)
         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))));
+       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')