From: Jason Merrill Date: Wed, 9 Mar 2011 01:28:19 +0000 (-0500) Subject: re PR c++/45651 (ICE in import_export_decl, at cp/decl2.c:2344) X-Git-Tag: releases/gcc-4.5.3~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07bb85b52a9c4072cf381a43c64e497f6208d08d;p=thirdparty%2Fgcc.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: r170806 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6c341f37d254..a35d9e9bc278 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 Jason Merrill PR c++/47289 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 77d2f87f980f..716a7c568e12 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -16721,8 +16721,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 9f5fa1ddb734..6e09fa368a5b 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 Jason Merrill * 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 index 000000000000..34599c061e7c --- /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) {}