1 // { dg-do compile }
2 
3 // Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
4 
5 // PR c++/495: Fail to locate primary class template that is
6 // injected by friend declaration.
7 
8 template <int N> struct X
9 {
10   template <int dim> friend struct Y;
11 };
12 
13 X<2> x;
14 
15 template <int dim> struct Y
16 {
17   void f (Y);
18   void g (Y);
19 };
20 
f(Y)21 template <int dim> void Y<dim>::f (Y)
22 {
23 }
24 
g(Y<dim>)25 template <int dim> void Y<dim>::g (Y<dim>)
26 {
27 }
28