blob: 5b82dc6b145e53b27fcb3379c8e5ec76dd65b1b3 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Douglas Gregor683a81f2011-01-31 16:09:46 +00002
3template<typename T>
4struct classify_function {
5 static const unsigned value = 0;
6};
7
8template<typename R, typename ...Args>
9struct classify_function<R(Args...)> {
10 static const unsigned value = 1;
11};
12
13template<typename R, typename ...Args>
14struct classify_function<R(Args...) const> { // expected-warning{{template argument of 'const' qualified function type is a GNU extension}}
15 static const unsigned value = 2;
16};
17
18template<typename R, typename ...Args>
19struct classify_function<R(Args...) volatile> { // expected-warning{{template argument of 'volatile' qualified function type is a GNU extension}}
20 static const unsigned value = 3;
21};
22
23template<typename R, typename ...Args>
24struct classify_function<R(Args...) const volatile> { // expected-warning{{template argument of 'const volatile' qualified function type is a GNU extension}}
25 static const unsigned value = 4;
26};
27
28template<typename R, typename ...Args>
29struct classify_function<R(Args......)> {
30 static const unsigned value = 5;
31};
32
33template<typename R, typename ...Args>
34struct classify_function<R(Args......) const> { // expected-warning{{template argument of 'const' qualified function type is a GNU extension}}
35 static const unsigned value = 6;
36};
37
38template<typename R, typename ...Args>
39struct classify_function<R(Args......) volatile> { // expected-warning{{template argument of 'volatile' qualified function type is a GNU extension}}
40 static const unsigned value = 7;
41};
42
43template<typename R, typename ...Args>
44struct classify_function<R(Args......) const volatile> { // expected-warning{{template argument of 'const volatile' qualified function type is a GNU extension}}
45 static const unsigned value = 8;
46};
47
48template<typename R, typename ...Args>
49struct classify_function<R(Args......) &&> { // expected-warning{{template argument of '&&' qualified function type is a GNU extension}}
50 static const unsigned value = 9;
51};
52
53template<typename R, typename ...Args>
54struct classify_function<R(Args......) const &> { // expected-warning{{template argument of 'const &' qualified function type is a GNU extension}}
55 static const unsigned value = 10;
56};
57
58typedef void f0(int) const;
59typedef void f1(int, float...) const volatile;
60typedef void f2(int, double, ...) &&;
61typedef void f3(int, double, ...) const &;
62
63int check0[classify_function<f0>::value == 2? 1 : -1];
64int check1[classify_function<f1>::value == 8? 1 : -1];
65int check2[classify_function<f2>::value == 9? 1 : -1];
66int check3[classify_function<f3>::value == 10? 1 : -1];