]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/45651 (ICE in import_export_decl, at cp/decl2.c:2344)
authorJason Merrill <jason@redhat.com>
Wed, 9 Mar 2011 01:28:13 +0000 (20:28 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 9 Mar 2011 01:28:13 +0000 (20:28 -0500)
PR c++/45651
* pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on
!TREE_PUBLIC decls.

From-SVN: r170805

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

index fb0f7037a6d4d5dba1fc54b082146cda4b426063..ce2384af3e2ffdbddd97c60c147e5444c8d5213c 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  Jason Merrill  <jason@redhat.com>
 
        PR c++/47289
index 6b3bc5a5c69e75cb9ab8768f33982f807af423d5..fb60c49723ea76647c999ba5f9492650be62bea2 100644 (file)
@@ -15533,8 +15533,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 93ca909814542fd89f45585f4ea0152bfa28419d..9d6cda6ece9efb141aa5b9a24e87dcc324a1e66d 100644 (file)
@@ -1,3 +1,7 @@
+2011-03-08  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/template/anon5.C: New.
+
 2011-03-08  Jason Merrill  <jason@redhat.com>
 
        * g++.dg/cpp0x/variadic105.C: New.
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>) {}