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
8template <class T> class O {
9  struct I { I (int); };
10
11  template <class T_>
12  friend typename O<T_>::I f ();
13};
14
15template <class T_>
16typename O<T_>::I f () { return 1; }
17
18struct X {
19    void g() { f<int>(); }
20};
21