diff options
author | Jason Merrill <jason@redhat.com> | 2010-04-07 11:54:42 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-04-07 11:54:42 -0400 |
commit | feb3b88ad7ea6de3d0f63b41226f0b90c36a0c07 (patch) | |
tree | cff0e08f71b364fc0ce4649355d0bef0429f0ea4 /gcc/cp/pt.c | |
parent | 7dcfe861f19429326f0b82c4fdccd7d7088ae68b (diff) | |
download | gcc-feb3b88ad7ea6de3d0f63b41226f0b90c36a0c07.zip gcc-feb3b88ad7ea6de3d0f63b41226f0b90c36a0c07.tar.gz gcc-feb3b88ad7ea6de3d0f63b41226f0b90c36a0c07.tar.bz2 |
re PR c++/38392 (Template friend function injection)
PR c++/38392
* pt.c (tsubst_friend_function): Instatiate a friend that has already
been used.
From-SVN: r158073
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d1c33d6..1c0e13e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7330,11 +7330,18 @@ tsubst_friend_function (tree decl, tree args) DECL_TEMPLATE_INFO (old_decl) = new_friend_template_info; if (TREE_CODE (old_decl) != TEMPLATE_DECL) - /* We should have called reregister_specialization in - duplicate_decls. */ - gcc_assert (retrieve_specialization (new_template, - new_args, 0) - == old_decl); + { + /* We should have called reregister_specialization in + duplicate_decls. */ + gcc_assert (retrieve_specialization (new_template, + new_args, 0) + == old_decl); + + /* Instantiate it if the global has already been used. */ + if (DECL_ODR_USED (old_decl)) + instantiate_decl (old_decl, /*defer_ok=*/true, + /*expl_inst_class_mem_p=*/false); + } else { tree t; |