1 /*<-
2 Copyright (c) 2016 Barrett Adair
3 
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
6 ->*/
7 
8 
9 #include <boost/callable_traits/apply_member_pointer.hpp>
10 #include "test.hpp"
11 
12 struct foo;
13 
14 template<typename Input, typename Output>
test_case()15 void test_case() {
16     assert_same<TRAIT(apply_member_pointer, Input, foo), Output>();
17 }
18 
main()19 int main() {
20 
21     test_case<int(),                               int(foo::*)()                               >();
22 
23 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
24     test_case<int() TX_SAFE,                       int(foo::*)() TX_SAFE                       >();
25     test_case<int() LREF,                          int(foo::*)() LREF                          >();
26     test_case<int() LREF TX_SAFE,                  int(foo::*)() LREF TX_SAFE                  >();
27     test_case<int() RREF,                          int(foo::*)() RREF                          >();
28     test_case<int() RREF TX_SAFE,                  int(foo::*)() RREF TX_SAFE                  >();
29     test_case<int() const,                         int(foo::*)() const                         >();
30     test_case<int() const TX_SAFE,                 int(foo::*)() const TX_SAFE                 >();
31     test_case<int() const LREF,                    int(foo::*)() const LREF                    >();
32     test_case<int() const LREF TX_SAFE,            int(foo::*)() const LREF TX_SAFE            >();
33     test_case<int() const RREF,                    int(foo::*)() const RREF                    >();
34     test_case<int() const RREF TX_SAFE,            int(foo::*)() const RREF TX_SAFE            >();
35     test_case<int() volatile,                      int(foo::*)() volatile                      >();
36     test_case<int() volatile TX_SAFE,              int(foo::*)() volatile TX_SAFE              >();
37     test_case<int() volatile LREF,                 int(foo::*)() volatile LREF                 >();
38     test_case<int() volatile LREF TX_SAFE,         int(foo::*)() volatile LREF TX_SAFE         >();
39     test_case<int() volatile RREF,                 int(foo::*)() volatile RREF                 >();
40     test_case<int() volatile RREF TX_SAFE,         int(foo::*)() volatile RREF TX_SAFE         >();
41 #endif
42 
43     test_case<int(int),                            int(foo::*)(int)                            >();
44 
45 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
46     test_case<int(int) TX_SAFE,                    int(foo::*)(int) TX_SAFE                    >();
47     test_case<int(int) LREF,                       int(foo::*)(int) LREF                       >();
48     test_case<int(int) LREF TX_SAFE,               int(foo::*)(int) LREF TX_SAFE               >();
49     test_case<int(int) RREF,                       int(foo::*)(int) RREF                       >();
50     test_case<int(int) RREF TX_SAFE,               int(foo::*)(int) RREF TX_SAFE               >();
51     test_case<int(int) const,                      int(foo::*)(int) const                      >();
52     test_case<int(int) const TX_SAFE,              int(foo::*)(int) const TX_SAFE              >();
53     test_case<int(int) const LREF,                 int(foo::*)(int) const LREF                 >();
54     test_case<int(int) const LREF TX_SAFE,         int(foo::*)(int) const LREF TX_SAFE         >();
55     test_case<int(int) const RREF,                 int(foo::*)(int) const RREF                 >();
56     test_case<int(int) const RREF TX_SAFE,         int(foo::*)(int) const RREF TX_SAFE         >();
57     test_case<int(int) volatile,                   int(foo::*)(int) volatile                   >();
58     test_case<int(int) volatile TX_SAFE,           int(foo::*)(int) volatile TX_SAFE           >();
59     test_case<int(int) volatile LREF,              int(foo::*)(int) volatile LREF              >();
60     test_case<int(int) volatile LREF TX_SAFE,      int(foo::*)(int) volatile LREF TX_SAFE      >();
61     test_case<int(int) volatile RREF,              int(foo::*)(int) volatile RREF              >();
62     test_case<int(int) volatile RREF TX_SAFE,      int(foo::*)(int) volatile RREF TX_SAFE      >();
63 #endif
64 
65 //MSVC doesn't like varargs on abominable functions
66 #ifndef BOOST_CLBL_TRTS_MSVC
67 
68     test_case<int(...),                            int(foo::*)(...)                            >();
69 
70 
71 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
72     test_case<int(...) TX_SAFE,                    int(foo::*)(...) TX_SAFE                    >();
73     test_case<int(...) LREF,                       int(foo::*)(...) LREF                       >();
74     test_case<int(...) LREF TX_SAFE,               int(foo::*)(...) LREF TX_SAFE               >();
75     test_case<int(...) RREF,                       int(foo::*)(...) RREF                       >();
76     test_case<int(...) RREF TX_SAFE,               int(foo::*)(...) RREF TX_SAFE               >();
77     test_case<int(...) const,                      int(foo::*)(...) const                      >();
78     test_case<int(...) const TX_SAFE,              int(foo::*)(...) const TX_SAFE              >();
79     test_case<int(...) const LREF,                 int(foo::*)(...) const LREF                 >();
80     test_case<int(...) const LREF TX_SAFE,         int(foo::*)(...) const LREF TX_SAFE         >();
81     test_case<int(...) const RREF,                 int(foo::*)(...) const RREF                 >();
82     test_case<int(...) const RREF TX_SAFE,         int(foo::*)(...) const RREF TX_SAFE         >();
83     test_case<int(...) volatile,                   int(foo::*)(...) volatile                   >();
84     test_case<int(...) volatile TX_SAFE,           int(foo::*)(...) volatile TX_SAFE           >();
85     test_case<int(...) volatile LREF,              int(foo::*)(...) volatile LREF              >();
86     test_case<int(...) volatile LREF TX_SAFE,      int(foo::*)(...) volatile LREF TX_SAFE      >();
87     test_case<int(...) volatile RREF,              int(foo::*)(...) volatile RREF              >();
88     test_case<int(...) volatile RREF TX_SAFE,      int(foo::*)(...) volatile RREF TX_SAFE      >();
89 #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
90 
91     test_case<int(int, ...),                       int(foo::*)(int, ...)                       >();
92 
93 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
94     test_case<int(int, ...) TX_SAFE,               int(foo::*)(int, ...) TX_SAFE               >();
95     test_case<int(int, ...) LREF,                  int(foo::*)(int, ...) LREF                  >();
96     test_case<int(int, ...) LREF TX_SAFE,          int(foo::*)(int, ...) LREF TX_SAFE          >();
97     test_case<int(int, ...) RREF,                  int(foo::*)(int, ...) RREF                  >();
98     test_case<int(int, ...) RREF TX_SAFE,          int(foo::*)(int, ...) RREF TX_SAFE          >();
99     test_case<int(int, ...) const,                 int(foo::*)(int, ...) const                 >();
100     test_case<int(int, ...) const TX_SAFE,         int(foo::*)(int, ...) const TX_SAFE         >();
101     test_case<int(int, ...) const LREF,            int(foo::*)(int, ...) const LREF            >();
102     test_case<int(int, ...) const LREF TX_SAFE,    int(foo::*)(int, ...) const LREF TX_SAFE    >();
103     test_case<int(int, ...) const RREF,            int(foo::*)(int, ...) const RREF            >();
104     test_case<int(int, ...) const RREF TX_SAFE,    int(foo::*)(int, ...) const RREF TX_SAFE    >();
105     test_case<int(int, ...) volatile,              int(foo::*)(int, ...) volatile              >();
106     test_case<int(int, ...) volatile TX_SAFE,      int(foo::*)(int, ...) volatile TX_SAFE      >();
107     test_case<int(int, ...) volatile LREF,         int(foo::*)(int, ...) volatile LREF         >();
108     test_case<int(int, ...) volatile LREF TX_SAFE, int(foo::*)(int, ...) volatile LREF TX_SAFE >();
109     test_case<int(int, ...) volatile RREF,         int(foo::*)(int, ...) volatile RREF         >();
110     test_case<int(int, ...) volatile RREF TX_SAFE, int(foo::*)(int, ...) volatile RREF TX_SAFE >();
111 #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
112 #endif //#ifndef BOOST_CLBL_TRTS_MSVC
113 
114 }
115