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