1 // { dg-do compile }
2 
3 // Origin: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
4 
5 // Perform access checking to parameter and return type of
6 // function template correctly when the template is friend.
7 
8 template <class T> class O {
9   struct I { I (int); };
10 
11   template <class T_>
12   friend typename O<T_>::I f ();
13 };
14 
15 template <class T_>
f()16 typename O<T_>::I f () { return 1; }
17 
18 struct X {
gX19     void g() { f<int>(); }
20 };
21