View | Details | Return to bug 38392
Collapse All | Expand All

(-)a/gcc/cp/pt.c (-5 / +12 lines)
Lines 7141-7151 tsubst_friend_function (tree decl, tree args) Link Here
7141
	      DECL_TEMPLATE_INFO (old_decl) = new_friend_template_info;
7141
	      DECL_TEMPLATE_INFO (old_decl) = new_friend_template_info;
7142
7142
7143
	      if (TREE_CODE (old_decl) != TEMPLATE_DECL)
7143
	      if (TREE_CODE (old_decl) != TEMPLATE_DECL)
7144
		/* We should have called reregister_specialization in
7144
		{
7145
		   duplicate_decls.  */
7145
		  /* We should have called reregister_specialization in
7146
		gcc_assert (retrieve_specialization (new_template,
7146
		     duplicate_decls.  */
7147
						     new_args, 0)
7147
		  gcc_assert (retrieve_specialization (new_template,
7148
			    == old_decl);
7148
						       new_args, 0)
7149
			      == old_decl);
7150
7151
		  /* Instantiate it if the global has already been used.  */
7152
		  if (DECL_ODR_USED (old_decl))
7153
		    instantiate_decl (old_decl, /*defer_ok=*/true,
7154
				      /*expl_inst_class_mem_p=*/false);
7155
		}
7149
	      else
7156
	      else
7150
		{
7157
		{
7151
		  tree t;
7158
		  tree t;
(-)a/gcc/testsuite/g++.dg/template/friend51.C (+16 lines)
Line 0 Link Here
1
// PR c++/38392
2
3
void Function();
4
5
int main()
6
{
7
  Function();
8
}
9
10
template <typename T>
11
struct Test
12
{
13
  friend void Function() { }
14
};
15
16
template class Test<int>;

Return to bug 38392