summaryrefslogtreecommitdiffstats
path: root/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
blob: a6b1172afccc004a2621f62c17f215117c38736d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s

// Deductions specific to C++0x.

template<typename T>
struct member_pointer_kind {
  static const unsigned value = 0;
};

template<class C, typename R, typename ...Args>
struct member_pointer_kind<R (C::*)(Args...)> {
  static const unsigned value = 1;
};

template<class C, typename R, typename ...Args>
struct member_pointer_kind<R (C::*)(Args...) &> {
  static const unsigned value = 2;
};

template<class C, typename R, typename ...Args>
struct member_pointer_kind<R (C::*)(Args...) &&> {
  static const unsigned value = 3;
};

template<class C, typename R, typename ...Args>
struct member_pointer_kind<R (C::*)(Args...) const> {
  static const unsigned value = 4;
};

template<class C, typename R, typename ...Args>
struct member_pointer_kind<R (C::*)(Args...) const &> {
  static const unsigned value = 5;
};

template<class C, typename R, typename ...Args>
struct member_pointer_kind<R (C::*)(Args...) const &&> {
  static const unsigned value = 6;
};

struct X { };

static_assert(member_pointer_kind<int (X::*)(int)>::value == 1, "");
static_assert(member_pointer_kind<int (X::*)(int) &>::value == 2, "");
static_assert(member_pointer_kind<int (X::*)(int) &&>::value == 3, "");
static_assert(member_pointer_kind<int (X::*)(int) const>::value == 4, "");
static_assert(member_pointer_kind<int (X::*)(int) const&>::value == 5, "");
static_assert(member_pointer_kind<int (X::*)(int) const&&>::value == 6, "");