1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<class T> struct A {
3 void f(T);
4 template<class X1> void g1(T, X1);
5 template<class X2> void g2(T, X2);
hA6 void h(T) { }
7 };
8
9 // specialization
10 template<> void A<int>::f(int);
11
12 // out of class member template definition
g1(T,X1)13 template<class T> template<class X1> void A<T>::g1(T, X1) { }
14
15 // member template specialization
16 template<> template<class X1> void A<int>::g1(int, X1);
17
18 // member template specialization
19 template<> template<>
20 void A<int>::g1(int, char); // X1 deduced as char
21
22 template<> template<>
23 void A<int>::g2<char>(int, char); // X2 specified as char
24 // member specialization even if defined in class definition
25
h(int)26 template<> void A<int>::h(int) { }
27
28 namespace PR10024 {
29 template <typename T>
30 struct Test{
31 template <typename U>
getPR10024::Test32 void get(U i) {}
33 };
34
35 template <typename T>
36 template <>
get(double i)37 void Test<T>::get<double>(double i) {} // expected-error{{cannot specialize (with 'template<>') a member of an unspecialized template}}
38 }
39