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 #include <boost/callable_traits/detail/config.hpp>
9
10
11 #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
main()12 int main(){}
13 #else
14
15 #include <boost/callable_traits/add_noexcept.hpp>
16 #include "test.hpp"
17
18 template<typename Noexcept, typename NotNoexcept>
test()19 void test() {
20
21 CT_ASSERT(std::is_same<Noexcept, TRAIT(add_noexcept, NotNoexcept)>::value);
22
23 //sanity check
24 CT_ASSERT(!std::is_same<Noexcept, NotNoexcept>::value);
25 }
26
27 #define TEST_NOEXCEPT(not_noexcept) test<not_noexcept noexcept, not_noexcept>()
28
main()29 int main() {
30
31 TEST_NOEXCEPT(int(int) &);
32 TEST_NOEXCEPT(int(*)(int));
33 TEST_NOEXCEPT(int(int, ...) &&);
34 TEST_NOEXCEPT(int(*)(int, ...));
35
36 struct foo;
37
38 TEST_NOEXCEPT(int(foo::*)(int));
39 TEST_NOEXCEPT(int(foo::*)(int) const);
40 TEST_NOEXCEPT(int(foo::*)(int, ...));
41 TEST_NOEXCEPT(int(foo::*)(int, ...) volatile);
42 }
43
44 #endif // #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES
45
46