152
|
1 // Verify that top-level cv-qualifiers on parameter types are considered
|
|
2 // when determining the function type of an instantiated function template.
|
|
3 // This resolves a part of Core issues 1001/1322.
|
|
4 // { dg-do compile { target c++11 } }
|
|
5 // { dg-additional-options "-Wno-volatile" }
|
|
6
|
|
7 template<typename... Ts>
|
|
8 void foo0(Ts... t);
|
|
9
|
|
10 template<typename... Ts>
|
|
11 void foo1(const Ts... t);
|
|
12
|
|
13 template<typename... Ts>
|
|
14 void foo2(volatile Ts... t);
|
|
15
|
|
16 template<typename... Ts>
|
|
17 void foo3(const volatile Ts... t);
|
|
18
|
|
19 #if __cplusplus >= 201103L
|
|
20 #define SA(X) static_assert(X,#X)
|
|
21 SA(__is_same(decltype(foo0<char[]>), void(char*)));
|
|
22 SA(__is_same(decltype(foo0<const char[]>), void(const char*)));
|
|
23 SA(__is_same(decltype(foo0<volatile char[]>), void(volatile char*)));
|
|
24 SA(__is_same(decltype(foo0<const volatile char[]>), void(const volatile char*)));
|
|
25
|
|
26 SA(__is_same(decltype(foo1<char[]>), void(const char*)));
|
|
27 SA(__is_same(decltype(foo1<const char[]>), void(const char*)));
|
|
28 SA(__is_same(decltype(foo1<volatile char[]>), void(const volatile char*)));
|
|
29 SA(__is_same(decltype(foo1<const volatile char[]>), void(const volatile char*)));
|
|
30
|
|
31 SA(__is_same(decltype(foo2<char[]>), void(volatile char*)));
|
|
32 SA(__is_same(decltype(foo2<const char[]>), void(const volatile char*)));
|
|
33 SA(__is_same(decltype(foo2<volatile char[]>), void(volatile char*)));
|
|
34 SA(__is_same(decltype(foo2<const volatile char[]>), void(const volatile char*)));
|
|
35
|
|
36 SA(__is_same(decltype(foo3<char[]>), void(const volatile char*)));
|
|
37 SA(__is_same(decltype(foo3<const char[]>), void(const volatile char*)));
|
|
38 SA(__is_same(decltype(foo3<volatile char[]>), void(const volatile char*)));
|
|
39 SA(__is_same(decltype(foo3<const volatile char[]>), void(const volatile char*)));
|
|
40 #endif
|
|
41
|
|
42 int main()
|
|
43 {
|
|
44 foo0<char[]>(0);
|
|
45 foo0<const char[]>(0);
|
|
46 foo0<volatile char[]>(0);
|
|
47 foo0<const volatile char[]>(0);
|
|
48
|
|
49 foo1<char[]>(0);
|
|
50 foo1<const char[]>(0);
|
|
51 foo1<volatile char[]>(0);
|
|
52 foo1<const volatile char[]>(0);
|
|
53
|
|
54 foo2<char[]>(0);
|
|
55 foo2<const char[]>(0);
|
|
56 foo2<volatile char[]>(0);
|
|
57 foo2<const volatile char[]>(0);
|
|
58
|
|
59 foo3<char[]>(0);
|
|
60 foo3<const char[]>(0);
|
|
61 foo3<volatile char[]>(0);
|
|
62 foo3<const volatile char[]>(0);
|
|
63 }
|