1
- // RUN: %clang_cc1 -fsyntax-only -verify %s
1
+ // RUN: %clang_cc1 -fsyntax-only -verify=expected,spec %s
2
+ // RUN: %clang_cc1 -fsyntax-only -verify -Wno-explicit-specialization-storage-class %s
2
3
3
4
// A storage-class-specifier shall not be specified in an explicit
4
5
// specialization (14.7.3) or an explicit instantiation (14.7.2)
@@ -7,13 +8,13 @@ template<typename T> void f(T) {}
7
8
template <typename T> static void g (T) {}
8
9
9
10
10
- template <> static void f<int >(int ); // expected -warning{{explicit specialization cannot have a storage class}}
11
+ template <> static void f<int >(int ); // spec -warning{{explicit specialization cannot have a storage class}}
11
12
template static void f<float >(float ); // expected-error{{explicit instantiation cannot have a storage class}}
12
13
13
14
template <> void f<double >(double );
14
15
template void f<long >(long );
15
16
16
- template <> static void g<int >(int ); // expected -warning{{explicit specialization cannot have a storage class}}
17
+ template <> static void g<int >(int ); // spec -warning{{explicit specialization cannot have a storage class}}
17
18
template static void g<float >(float ); // expected-error{{explicit instantiation cannot have a storage class}}
18
19
19
20
template <> void g<double >(double );
@@ -29,5 +30,12 @@ int X<T>::value = 17;
29
30
30
31
template static int X<int >::value; // expected-error{{explicit instantiation cannot have a storage class}}
31
32
32
- template <> static int X<float >::value; // expected -warning{{explicit specialization cannot have a storage class}}
33
+ template <> static int X<float >::value; // spec -warning{{explicit specialization cannot have a storage class}}
33
34
// expected-error@-1{{'static' can only be specified inside the class definition}}
35
+
36
+ struct t1 {
37
+ template <typename >
38
+ static void f1 ();
39
+ template <>
40
+ static void f1<int >(); // spec-warning{{explicit specialization cannot have a storage class}}
41
+ };
0 commit comments