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