]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/callable_traits/test/has_void_return.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / callable_traits / test / has_void_return.cpp
1 #include <tuple>
2 #include <utility>
3 #include <type_traits>
4 #include <boost/callable_traits/has_void_return.hpp>
5 #include "test.hpp"
6
7 struct foo;
8
9 template<typename T>
10 void assert_void_return() {
11 CT_ASSERT(has_void_return<T>::value);
12 }
13
14 template<typename T>
15 void assert_not_void_return() {
16 CT_ASSERT(!has_void_return<T>::value);
17 }
18
19 int main() {
20
21 assert_void_return<void()>();
22 assert_void_return<void(...)>();
23
24 #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
25 assert_void_return<void(int) const>();
26 assert_void_return<void(int) volatile>();
27 assert_void_return<void(int) const volatile>();
28 #endif // #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
29
30 assert_void_return<void(foo::*)()>();
31 assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC foo::*)(int, ...)>();
32 assert_void_return<void(foo::*)(int) const>();
33 assert_void_return<void(foo::*)() volatile>();
34 assert_void_return<void(foo::*)(int) const volatile>();
35
36 assert_void_return<void(*)()>();
37 assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC *)(int, ...)>();
38
39 assert_void_return<void(&)(int)>();
40 assert_void_return<void(BOOST_CLBL_TRTS_DEFAULT_VARARGS_CC &)(...)>();
41
42 auto lambda = []{};
43 assert_void_return<decltype(lambda)>();
44
45 assert_not_void_return<void>();
46 assert_not_void_return<int>();
47 assert_not_void_return<void*>();
48 assert_not_void_return<void* foo::*>();
49 assert_not_void_return<void(** const)()>();
50 assert_not_void_return<int()>();
51 assert_not_void_return<int(*)()>();
52 assert_not_void_return<int(&)()>();
53 assert_not_void_return<int(foo::*)()>();
54 assert_not_void_return<int(foo::*)() const>();
55 assert_not_void_return<int(foo::*)() volatile>();
56 assert_not_void_return<int(foo::*)() const volatile>();
57 assert_not_void_return<void(foo::**)()>();
58 }