OSDN Git Service

PR c++/52759
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Mar 2012 15:05:42 +0000 (15:05 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Mar 2012 15:05:42 +0000 (15:05 +0000)
* decl.c (start_decl): Don't call maybe_apply_pragma_weak
if processing_template_decl.

* g++.dg/ext/weak4.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@185967 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/weak4.C [new file with mode: 0644]

index 00e89e2..2ada456 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52759
+       * decl.c (start_decl): Don't call maybe_apply_pragma_weak
+       if processing_template_decl.
+
 2012-03-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/52743
 2012-03-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/52743
index 74307b1..01a199f 100644 (file)
@@ -4420,7 +4420,8 @@ start_decl (const cp_declarator *declarator,
     }
 
   /* If #pragma weak was used, mark the decl weak now.  */
     }
 
   /* If #pragma weak was used, mark the decl weak now.  */
-  maybe_apply_pragma_weak (decl);
+  if (!processing_template_decl)
+    maybe_apply_pragma_weak (decl);
 
   if (TREE_CODE (decl) == FUNCTION_DECL
       && DECL_DECLARED_INLINE_P (decl)
 
   if (TREE_CODE (decl) == FUNCTION_DECL
       && DECL_DECLARED_INLINE_P (decl)
index 14dfe57..b149fcd 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52759
+       * g++.dg/ext/weak4.C: New test.
+
 2012-03-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/52743
 2012-03-29  Jason Merrill  <jason@redhat.com>
 
        PR c++/52743
diff --git a/gcc/testsuite/g++.dg/ext/weak4.C b/gcc/testsuite/g++.dg/ext/weak4.C
new file mode 100644 (file)
index 0000000..5b3cce0
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/52759
+// { dg-do compile }
+// { dg-require-weak "" }
+// { dg-options "" }
+#pragma weak foo
+template <typename T>
+struct A { };
+template <typename T>
+void bar (A<T> &);