aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2008-02-24 09:19:39 +0000
committerDanny Smith <dannysmith@gcc.gnu.org>2008-02-24 09:19:39 +0000
commitbdd6df52bdc1e3f280377f91f7c3a5e825a7461e (patch)
tree40c61febe42d8e42bc09fb68c73f43dc0b9b2dc6 /gcc
parent153fbec8c7fa71a3da7368b8b0640ef910c30063 (diff)
downloadgcc-bdd6df52bdc1e3f280377f91f7c3a5e825a7461e.zip
gcc-bdd6df52bdc1e3f280377f91f7c3a5e825a7461e.tar.gz
gcc-bdd6df52bdc1e3f280377f91f7c3a5e825a7461e.tar.bz2
re PR c++/34749 (Incorrect warning when applying dllimport to friend function)
cp PR c++/34749 * friend.c (do_friend): Call cplus_decl_attributes earlier. testsuite PR c++/34749 * g++.dg.ext/dllimport13.C: New test. From-SVN: r132585
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/friend.c14
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/dllimport13.C14
4 files changed, 31 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 19709c1..68f9a7b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index ffb0baa..c4dfcc5 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -413,6 +413,13 @@ do_friend (tree ctype, tree declarator, tree decl,
/* 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);
@@ -582,12 +589,5 @@ do_friend (tree ctype, tree declarator, tree decl,
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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 62ab6a8..b5f5a89 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-24 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c++/34749
+ * g++.dg.ext/dllimport13.C: New test.
+
2008-02-23 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/24685
diff --git a/gcc/testsuite/g++.dg/ext/dllimport13.C b/gcc/testsuite/g++.dg/ext/dllimport13.C
new file mode 100644
index 0000000..a0d4ab5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/dllimport13.C
@@ -0,0 +1,14 @@
+// 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" }
+};