+2008-02-24 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/34749
+ * friend.c (do_friend): Call cplus_decl_attributes earlier.
+
2008-02-22 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/34715
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
+ /* Unfortunately, we have to handle attributes here. Normally we would
+ handle them in start_decl_1, but since this is a friend decl start_decl_1
+ never gets to see it. */
+
+ /* Set attributes here so if duplicate decl, will have proper attributes. */
+ cplus_decl_attributes (&decl, attrlist, 0);
+
if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
{
declarator = TREE_OPERAND (declarator, 0);
DECL_FRIEND_P (decl) = 1;
}
- /* Unfortunately, we have to handle attributes here. Normally we would
- handle them in start_decl_1, but since this is a friend decl start_decl_1
- never gets to see it. */
-
- /* Set attributes here so if duplicate decl, will have proper attributes. */
- cplus_decl_attributes (&decl, attrlist, 0);
-
return decl;
}
--- /dev/null
+// PR c++/34749
+// Ensure dllimport is handled correctly for friends
+
+// { dg-do compile { target i?86-*-cygwin* i?86-*-mingw*} }
+
+int __declspec (dllimport) bar();
+int __declspec (dllimport) baz();
+
+class Foo
+{
+// MS requires that the dllimport attribute be specified on each declaration
+ friend int __declspec (dllimport) bar();
+ friend int baz(); // { dg-warning "dllimport ignored" }
+};