aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-04-06 15:55:00 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2005-04-06 15:55:00 +0000
commitb17bba6d2418e39417d204a8e1a7998077a185d7 (patch)
treefcd2fbe70a5a93fad69ed7c5e1225fc6d4b544f8 /gcc
parent20bc438ce92474b44e45d2d2b2d14c04da412316 (diff)
downloadgcc-b17bba6d2418e39417d204a8e1a7998077a185d7.zip
gcc-b17bba6d2418e39417d204a8e1a7998077a185d7.tar.gz
gcc-b17bba6d2418e39417d204a8e1a7998077a185d7.tar.bz2
re PR c++/20212 (attribute unused vs. member function template)
PR c++/20212 * pt.c (regenerate_decl_from_template): Copy attributes for parameters from the pattern to the instantiation. PR c++/20212 * g++.dg/warn/Wunused-11.C: New test. From-SVN: r97726
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/Wunused-11.C11
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4987454..39e5a45 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2005-04-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/20212
+ * pt.c (regenerate_decl_from_template): Copy attributes for
+ parameters from the pattern to the instantiation.
+
2005-04-05 Mark Mitchell <mark@codesourcery.com>
PR c++/20734
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index b609ecf..a6f8ad2 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11190,6 +11190,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
while (decl_parm)
{
tree parm_type;
+ tree attributes;
if (DECL_NAME (decl_parm) != DECL_NAME (pattern_parm))
DECL_NAME (decl_parm) = DECL_NAME (pattern_parm);
@@ -11198,6 +11199,12 @@ regenerate_decl_from_template (tree decl, tree tmpl)
parm_type = type_decays_to (parm_type);
if (!same_type_p (TREE_TYPE (decl_parm), parm_type))
TREE_TYPE (decl_parm) = parm_type;
+ attributes = DECL_ATTRIBUTES (pattern_parm);
+ if (DECL_ATTRIBUTES (decl_parm) != attributes)
+ {
+ DECL_ATTRIBUTES (decl_parm) = attributes;
+ cplus_decl_attributes (&decl_parm, attributes, /*flags=*/0);
+ }
decl_parm = TREE_CHAIN (decl_parm);
pattern_parm = TREE_CHAIN (pattern_parm);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index baced95..e70b4b2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-04-06 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/20212
+ * g++.dg/warn/Wunused-11.C: New test.
+
2005-04-06 Bernd Schmidt <bernd.schmidt@analog.com>
* gcc.c-torture/execute/20020720-1.x: Disable on bfin*-*.
diff --git a/gcc/testsuite/g++.dg/warn/Wunused-11.C b/gcc/testsuite/g++.dg/warn/Wunused-11.C
new file mode 100644
index 0000000..4a151d2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wunused-11.C
@@ -0,0 +1,11 @@
+// PR c++/20212
+// { dg-options "-O2 -Wunused -Wextra" }
+
+template<int> void f(int);
+void g(int i)
+{
+ f<0>(i);
+}
+template<int> void f(int i __attribute__((unused)) )
+{}
+