1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<typename T>
3 void f(T);
4 
5 template<typename T>
6 struct A { }; // expected-note{{template is declared here}}
7 
8 struct X {
9   template<> friend void f<int>(int); // expected-error{{in a friend}}
10   template<> friend class A<int>; // expected-error{{cannot be a friend}}
11 
12   friend void f<float>(float); // okay
13   friend class A<float>; // okay
14 };
15 
16 struct PR41792 {
17   // expected-error@+1{{cannot declare an explicit specialization in a friend}}
18   template <> friend void f<>(int);
19 
20   // expected-error@+2{{template specialization declaration cannot be a friend}}
21   // expected-error@+1{{too few template arguments for class template 'A'}}
22   template <> friend class A<>;
23 };
24