OSDN Git Service

PR c++/45651
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Mar 2011 17:30:25 +0000 (17:30 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Mar 2011 17:30:25 +0000 (17:30 +0000)
* pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on
!TREE_PUBLIC decls.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170781 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/anon5.C [new file with mode: 0644]

index 883175a..319bdf3 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-08  Jason Merrill  <jason@redhat.com>
+
+       PR c++/45651
+       * pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on
+       !TREE_PUBLIC decls.
+
 2011-03-08  Dodji Seketeli  <dodji@redhat.com>
 
        PR c++/47957
index 076224c..48f9382 100644 (file)
@@ -17224,8 +17224,13 @@ instantiate_decl (tree d, int defer_ok,
   if (!pattern_defined && expl_inst_class_mem_p
       && DECL_EXPLICIT_INSTANTIATION (d))
     {
-      DECL_NOT_REALLY_EXTERN (d) = 0;
-      DECL_INTERFACE_KNOWN (d) = 0;
+      /* Leave linkage flags alone on instantiations with anonymous
+        visibility.  */
+      if (TREE_PUBLIC (d))
+       {
+         DECL_NOT_REALLY_EXTERN (d) = 0;
+         DECL_INTERFACE_KNOWN (d) = 0;
+       }
       SET_DECL_IMPLICIT_INSTANTIATION (d);
     }
 
index d9297fe..28caa91 100644 (file)
@@ -1,3 +1,7 @@
+2011-03-08  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/template/anon5.C: New.
+
 2011-03-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/47881
diff --git a/gcc/testsuite/g++.dg/template/anon5.C b/gcc/testsuite/g++.dg/template/anon5.C
new file mode 100644 (file)
index 0000000..34599c0
--- /dev/null
@@ -0,0 +1,6 @@
+// PR c++/45651
+
+namespace { template <int T> struct A {}; }
+template <int T> struct B { void f(A<T>); };
+template struct B<1>;
+template<int T> void B<T>::f(A<T>) {}