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