diff options
author | Mark Mitchell <mark@codesourcery.com> | 2003-04-29 22:15:34 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2003-04-29 22:15:34 +0000 |
commit | 1f6f0cb610621cec5a80b54ba850fee18d4282ad (patch) | |
tree | 01084a77e16fc0970395d29f0d377781f92e0c60 /gcc | |
parent | 51dc3d74f84691bda6b24b495ec8cd0f9e52460d (diff) | |
download | gcc-1f6f0cb610621cec5a80b54ba850fee18d4282ad.zip gcc-1f6f0cb610621cec5a80b54ba850fee18d4282ad.tar.gz gcc-1f6f0cb610621cec5a80b54ba850fee18d4282ad.tar.bz2 |
re PR c++/10551 (Failure to emit explicitly instantiated template w/--no-implicit-templates)
PR c++/10551
* pt.c (mark_decl_instantiated): Defer all explicit instantiations
that have not yet been written out.
PR c++/10551
* g++.dg/template/explicit1.C: New test.
From-SVN: r66263
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/explicit1.C | 17 |
4 files changed, 40 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3da0676..f255e13 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2003-04-29 Mark Mitchell <mark@codesourcery.com> + PR c++/10551 + * pt.c (mark_decl_instantiated): Defer all explicit instantiations + that have not yet been written out. + +2003-04-29 Mark Mitchell <mark@codesourcery.com> + PR c++/10549 * class.c (layout_class_type): Mark overlong bitfields as having the maximum size permitted by their type, after layout. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 02d910d..52df60b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9915,11 +9915,6 @@ mark_decl_instantiated (result, extern_p) tree result; int extern_p; { - if (TREE_CODE (result) != FUNCTION_DECL) - /* The TREE_PUBLIC flag for function declarations will have been - set correctly by tsubst. */ - TREE_PUBLIC (result) = 1; - /* We used to set this unconditionally; we moved that to do_decl_instantiation so it wouldn't get set on members of explicit class template instantiations. But we still need to set @@ -9928,6 +9923,16 @@ mark_decl_instantiated (result, extern_p) if (extern_p) SET_DECL_EXPLICIT_INSTANTIATION (result); + /* If this entity has already been written out, it's too late to + make any modifications. */ + if (TREE_ASM_WRITTEN (result)) + return; + + if (TREE_CODE (result) != FUNCTION_DECL) + /* The TREE_PUBLIC flag for function declarations will have been + set correctly by tsubst. */ + TREE_PUBLIC (result) = 1; + if (! extern_p) { DECL_INTERFACE_KNOWN (result) = 1; @@ -9941,7 +9946,8 @@ mark_decl_instantiated (result, extern_p) else if (TREE_PUBLIC (result)) maybe_make_one_only (result); } - else if (TREE_CODE (result) == FUNCTION_DECL) + + if (TREE_CODE (result) == FUNCTION_DECL) defer_fn (result); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9fba7a3..4a0d42c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2003-04-29 Mark Mitchell <mark@codesourcery.com> + PR c++/10551 + * g++.dg/template/explicit1.C: New test. + +2003-04-29 Mark Mitchell <mark@codesourcery.com> + PR c++/10549 * g++.dg/other/bitfield1.C: New test. diff --git a/gcc/testsuite/g++.dg/template/explicit1.C b/gcc/testsuite/g++.dg/template/explicit1.C new file mode 100644 index 0000000..64f581e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit1.C @@ -0,0 +1,17 @@ +// { dg-do link } +// { dg-options "-fno-implicit-templates" } + +template <class T> struct C { + ~C(); +}; +template <class T> C<T>::~C() {} + +struct X { + C<X> *p; + ~X() { delete p; } +}; + +template class C<X>; +C<X> x; + +int main () {} |