From: Jason Merrill Date: Tue, 8 Mar 2011 17:30:25 +0000 (-0500) Subject: re PR c++/45651 (ICE in import_export_decl, at cp/decl2.c:2344) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2c86a82aa431b1fc370290103a95c67bc8602473;p=gcc.git re PR c++/45651 (ICE in import_export_decl, at cp/decl2.c:2344) PR c++/45651 * pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on !TREE_PUBLIC decls. From-SVN: r170781 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 883175a8e33..319bdf3d7a3 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-03-08 Jason Merrill + + PR c++/45651 + * pt.c (instantiate_decl): Don't clear DECL_INTERFACE_KNOWN on + !TREE_PUBLIC decls. + 2011-03-08 Dodji Seketeli PR c++/47957 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 076224c46df..48f93822274 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d9297febc4f..28caa917a72 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-08 Jason Merrill + + * g++.dg/template/anon5.C: New. + 2011-03-08 Jakub Jelinek 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 index 00000000000..34599c061e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/anon5.C @@ -0,0 +1,6 @@ +// PR c++/45651 + +namespace { template struct A {}; } +template struct B { void f(A); }; +template struct B<1>; +template void B::f(A) {}