1 /*
2 Copyright Barrett Adair 2016-2017
3 Distributed under the Boost Software License, Version 1.0.
4 (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt)
5 */
6
7 #include <type_traits>
8 #include <functional>
9 #include <tuple>
10 #include <boost/callable_traits/add_member_const.hpp>
11 #include "test.hpp"
12
13 struct foo {};
14
main()15 int main() {
16
17 {
18 using f = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...);
19 using l = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) LREF;
20 using r = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) RREF ;
21 using c = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const;
22 using cl = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const LREF;
23 using cr = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const RREF;
24 using v = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) volatile;
25 using vl = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) volatile LREF;
26 using vr = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) volatile RREF;
27 using cv = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const volatile;
28 using cvl = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const volatile LREF;
29 using cvr = void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(...) const volatile RREF;
30
31 CT_ASSERT(std::is_same<c, TRAIT(add_member_const, f)>{});
32 CT_ASSERT(std::is_same<c, TRAIT(add_member_const, c)>{});
33 CT_ASSERT(std::is_same<cl, TRAIT(add_member_const, l)>{});
34 CT_ASSERT(std::is_same<cl, TRAIT(add_member_const, cl)>{});
35 CT_ASSERT(std::is_same<cr, TRAIT(add_member_const, r)>{});
36 CT_ASSERT(std::is_same<cr, TRAIT(add_member_const, cr)>{});
37 CT_ASSERT(std::is_same<cv, TRAIT(add_member_const, v)>{});
38 CT_ASSERT(std::is_same<cv, TRAIT(add_member_const, cv)>{});
39 CT_ASSERT(std::is_same<cvl, TRAIT(add_member_const, vl)>{});
40 CT_ASSERT(std::is_same<cvl, TRAIT(add_member_const, cvl)>{});
41 CT_ASSERT(std::is_same<cvr, TRAIT(add_member_const, vr)>{});
42 CT_ASSERT(std::is_same<cvr, TRAIT(add_member_const, cvr)>{});
43 }
44
45 {
46 using f = void(foo::*)(int, int);
47 using l = void(foo::*)(int, int) LREF;
48 using r = void(foo::*)(int, int) RREF ;
49 using c = void(foo::*)(int, int) const;
50 using cl = void(foo::*)(int, int) const LREF;
51 using cr = void(foo::*)(int, int) const RREF;
52 using v = void(foo::*)(int, int) volatile;
53 using vl = void(foo::*)(int, int) volatile LREF;
54 using vr = void(foo::*)(int, int) volatile RREF;
55 using cv = void(foo::*)(int, int) const volatile;
56 using cvl = void(foo::*)(int, int) const volatile LREF;
57 using cvr = void(foo::*)(int, int) const volatile RREF;
58
59 CT_ASSERT(std::is_same<c, TRAIT(add_member_const, f)>{});
60 CT_ASSERT(std::is_same<c, TRAIT(add_member_const, c)>{});
61 CT_ASSERT(std::is_same<cl, TRAIT(add_member_const, l)>{});
62 CT_ASSERT(std::is_same<cl, TRAIT(add_member_const, cl)>{});
63 CT_ASSERT(std::is_same<cr, TRAIT(add_member_const, r)>{});
64 CT_ASSERT(std::is_same<cr, TRAIT(add_member_const, cr)>{});
65 CT_ASSERT(std::is_same<cv, TRAIT(add_member_const, v)>{});
66 CT_ASSERT(std::is_same<cv, TRAIT(add_member_const, cv)>{});
67 CT_ASSERT(std::is_same<cvl, TRAIT(add_member_const, vl)>{});
68 CT_ASSERT(std::is_same<cvl, TRAIT(add_member_const, cvl)>{});
69 CT_ASSERT(std::is_same<cvr, TRAIT(add_member_const, vr)>{});
70 CT_ASSERT(std::is_same<cvr, TRAIT(add_member_const, cvr)>{});
71 }
72
73 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
74
75 {
76 using f = void();
77 using l = void() LREF;
78 using r = void() RREF ;
79 using c = void() const;
80 using cl = void() const LREF;
81 using cr = void() const RREF;
82 using v = void() volatile;
83 using vl = void() volatile LREF;
84 using vr = void() volatile RREF;
85 using cv = void() const volatile;
86 using cvl = void() const volatile LREF;
87 using cvr = void() const volatile RREF;
88
89 CT_ASSERT(std::is_same<c, TRAIT(add_member_const, f)>{});
90 CT_ASSERT(std::is_same<c, TRAIT(add_member_const, c)>{});
91 CT_ASSERT(std::is_same<cl, TRAIT(add_member_const, l)>{});
92 CT_ASSERT(std::is_same<cl, TRAIT(add_member_const, cl)>{});
93 CT_ASSERT(std::is_same<cr, TRAIT(add_member_const, r)>{});
94 CT_ASSERT(std::is_same<cr, TRAIT(add_member_const, cr)>{});
95 CT_ASSERT(std::is_same<cv, TRAIT(add_member_const, v)>{});
96 CT_ASSERT(std::is_same<cv, TRAIT(add_member_const, cv)>{});
97 CT_ASSERT(std::is_same<cvl, TRAIT(add_member_const, vl)>{});
98 CT_ASSERT(std::is_same<cvl, TRAIT(add_member_const, cvl)>{});
99 CT_ASSERT(std::is_same<cvr, TRAIT(add_member_const, vr)>{});
100 CT_ASSERT(std::is_same<cvr, TRAIT(add_member_const, cvr)>{});
101 }
102 #endif //#ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
103 }
104