1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2 // expected-no-diagnostics 3 4 // Deductions specific to C++0x. 5 6 template<typename T> 7 struct member_pointer_kind { 8 static const unsigned value = 0; 9 }; 10 11 template<class C, typename R, typename ...Args> 12 struct member_pointer_kind<R (C::*)(Args...)> { 13 static const unsigned value = 1; 14 }; 15 16 template<class C, typename R, typename ...Args> 17 struct member_pointer_kind<R (C::*)(Args...) &> { 18 static const unsigned value = 2; 19 }; 20 21 template<class C, typename R, typename ...Args> 22 struct member_pointer_kind<R (C::*)(Args...) &&> { 23 static const unsigned value = 3; 24 }; 25 26 template<class C, typename R, typename ...Args> 27 struct member_pointer_kind<R (C::*)(Args...) const> { 28 static const unsigned value = 4; 29 }; 30 31 template<class C, typename R, typename ...Args> 32 struct member_pointer_kind<R (C::*)(Args...) const &> { 33 static const unsigned value = 5; 34 }; 35 36 template<class C, typename R, typename ...Args> 37 struct member_pointer_kind<R (C::*)(Args...) const &&> { 38 static const unsigned value = 6; 39 }; 40 41 struct X { }; 42 43 static_assert(member_pointer_kind<int (X::*)(int)>::value == 1, ""); 44 static_assert(member_pointer_kind<int (X::*)(int) &>::value == 2, ""); 45 static_assert(member_pointer_kind<int (X::*)(int) &&>::value == 3, ""); 46 static_assert(member_pointer_kind<int (X::*)(int) const>::value == 4, ""); 47 static_assert(member_pointer_kind<int (X::*)(int) const&>::value == 5, ""); 48 static_assert(member_pointer_kind<int (X::*)(int) const&&>::value == 6, ""); 49