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