1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2 3 template<typename T> 4 struct classify_function { 5 static const unsigned value = 0; 6 }; 7 8 template<typename R, typename ...Args> 9 struct classify_function<R(Args...)> { 10 static const unsigned value = 1; 11 }; 12 13 template<typename R, typename ...Args> 14 struct 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 18 template<typename R, typename ...Args> 19 struct 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 23 template<typename R, typename ...Args> 24 struct 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 28 template<typename R, typename ...Args> 29 struct classify_function<R(Args......)> { 30 static const unsigned value = 5; 31 }; 32 33 template<typename R, typename ...Args> 34 struct 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 38 template<typename R, typename ...Args> 39 struct 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 43 template<typename R, typename ...Args> 44 struct 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 48 template<typename R, typename ...Args> 49 struct classify_function<R(Args......) &&> { // expected-warning{{template argument of '&&' qualified function type is a GNU extension}} 50 static const unsigned value = 9; 51 }; 52 53 template<typename R, typename ...Args> 54 struct 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 58 typedef void f0(int) const; 59 typedef void f1(int, float...) const volatile; 60 typedef void f2(int, double, ...) &&; 61 typedef void f3(int, double, ...) const &; 62 63 int check0[classify_function<f0>::value == 2? 1 : -1]; 64 int check1[classify_function<f1>::value == 8? 1 : -1]; 65 int check2[classify_function<f2>::value == 9? 1 : -1]; 66 int check3[classify_function<f3>::value == 10? 1 : -1]; 67