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/is_transaction_safe.hpp>
9 #include "test.hpp"
10 
11 template<typename Safe, typename NotSafe>
test()12 void test() {
13 
14     CT_ASSERT( is_transaction_safe<Safe>::value
15         // for when tx safe is disabled
16         || std::is_same<Safe, NotSafe>::value);
17     CT_ASSERT(! is_transaction_safe<NotSafe>::value);
18 }
19 
20 #define TEST_TRANSACTION_SAFE(not_safe) \
21     test<not_safe BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER, not_safe>()
22 
main()23 int main() {
24 
25     TEST_TRANSACTION_SAFE(int(*)());
26 
27     #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
28     TEST_TRANSACTION_SAFE(int(...) volatile LREF);
29     TEST_TRANSACTION_SAFE(int() const);
30     #endif
31 
32     TEST_TRANSACTION_SAFE(int(*)(...));
33 
34     struct foo;
35 
36     TEST_TRANSACTION_SAFE(int(foo::*)());
37     TEST_TRANSACTION_SAFE(int(foo::*)() const volatile);
38     TEST_TRANSACTION_SAFE(int(foo::*)(...));
39     TEST_TRANSACTION_SAFE(int(foo::*)(...) const volatile RREF);
40 }
41 
42