1 // PR c++/59366
2 // { dg-do compile }
3 template<typename T> void f(T);
4 
5 struct S
6 {
fS7   template<typename T> friend void f(T) {}
gS8   template<typename T> friend void g(T) {}
hS9   template<typename T> friend void h(T) {}
10 };
11 
12 template<typename T> void h(T);
13 
14 int
main()15 main ()
16 {
17   f(1);
18   g(1); // { dg-error "3:'g' was not declared in this scope" }
19   g(S());
20   h(1);
21 }
22