diff options
author | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-29 22:15:34 +0000 |
---|---|---|
committer | mmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-04-29 22:15:34 +0000 |
commit | 55293db378e6fc8bcf00012f18dcc62a9a1c87d1 (patch) | |
tree | 01084a77e16fc0970395d29f0d377781f92e0c60 /gcc/cp/pt.c | |
parent | 27ca74f713ef6192c9a0a2d826c7022301bf8fb8 (diff) | |
download | gcc-55293db378e6fc8bcf00012f18dcc62a9a1c87d1.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66263 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 02d910d5f34..52df60b59cf 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); } |