Skip to content
Snippets Groups Projects
Commit feb3b88a authored by Jason Merrill's avatar Jason Merrill Committed by Jason Merrill
Browse files

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
parent 7dcfe861
No related branches found
No related tags found
No related merge requests found
2010-04-07 Jason Merrill <jason@redhat.com>
PR c++/38392
* pt.c (tsubst_friend_function): Instatiate a friend that has already
been used.
* pt.c (print_template_statistics): New.
* cp-tree.h: Declare it.
* tree.c (cxx_print_statistics): Call it.
......
......@@ -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;
......
2010-04-07 Jason Merrill <jason@redhat.com>
PR c++/38392
* g++.dg/template/friend51.C: New test.
PR c++/41970
* g++.old-deja/g++.other/linkage1.C: Adjust.
......
// PR c++/38392
// { dg-do link }
void Function();
int main()
{
Function();
}
template <typename T>
struct Test
{
friend void Function() { }
};
template class Test<int>;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment