1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 // A storage-class-specifier shall not be specified in an explicit 4 // specialization (14.7.3) or an explicit instantiation (14.7.2) 5 // directive. 6 template<typename T> void f(T) {} 7 template<typename T> static void g(T) {} 8 9 10 template<> static void f<int>(int); // expected-error{{explicit specialization has extraneous, inconsistent storage class 'static'}} 11 template static void f<float>(float); // expected-error{{explicit instantiation cannot have a storage class}} 12 13 template<> void f<double>(double); 14 template void f<long>(long); 15 16 template<> static void g<int>(int); // expected-warning{{explicit specialization cannot have a storage class}} 17 template static void g<float>(float); // expected-error{{explicit instantiation cannot have a storage class}} 18 19 template<> void g<double>(double); 20 template void g<long>(long); 21 22 template<typename T> 23 struct X { 24 static int value; 25 }; 26 27 template<typename T> 28 int X<T>::value = 17; 29 30 template static int X<int>::value; // expected-error{{explicit instantiation cannot have a storage class}} 31 32 template<> static int X<float>::value; // expected-error{{'static' can only be specified inside the class definition}} 33