]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/callable_traits/test/add_noexcept_constraints.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / callable_traits / test / add_noexcept_constraints.cpp
1 /*
2 Copyright Barrett Adair 2016-2017
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/add_noexcept.hpp>
10 #include <tuple>
11 #include "test.hpp"
12
13 #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
14 int main(){}
15 #else
16
17 struct foo;
18
19 template<typename T>
20 struct is_substitution_failure_add_noexcept {
21
22 template<typename>
23 static auto test(...) -> std::true_type;
24
25 template<typename A,
26 typename std::remove_reference<
27 TRAIT(add_noexcept, A)>::type* = nullptr>
28 static auto test(int) -> std::false_type;
29
30 static constexpr bool value = decltype(test<T>(0))::value;
31 };
32
33 int main() {
34
35 auto lambda = [](){};
36
37 CT_ASSERT(is_substitution_failure_add_noexcept<decltype(lambda)>::value);
38 CT_ASSERT(is_substitution_failure_add_noexcept<decltype(lambda)&>::value);
39 CT_ASSERT(is_substitution_failure_add_noexcept<int>::value);
40 CT_ASSERT(is_substitution_failure_add_noexcept<int &>::value);
41 CT_ASSERT(is_substitution_failure_add_noexcept<int (* const &)()>::value);
42 CT_ASSERT(is_substitution_failure_add_noexcept<int (foo::* &)()>::value);
43 CT_ASSERT(is_substitution_failure_add_noexcept<int (foo::* const)()>::value);
44 CT_ASSERT(is_substitution_failure_add_noexcept<int (foo::* const &)()>::value);
45 CT_ASSERT(is_substitution_failure_add_noexcept<int (foo::* volatile)()>::value);
46 CT_ASSERT(is_substitution_failure_add_noexcept<void>::value);
47 CT_ASSERT(is_substitution_failure_add_noexcept<void*>::value);
48 CT_ASSERT(is_substitution_failure_add_noexcept<void(**)()>::value);
49 }
50
51 #endif //#ifndef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE