• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "test.hpp"
9 #include <boost/callable_traits/remove_transaction_safe.hpp>
10 
11 template<typename Safe, typename NotSafe>
test()12 void test() {
13 
14     CT_ASSERT(std::is_same<NotSafe, TRAIT(remove_transaction_safe, Safe)>::value);
15 
16     //sanity check
17     #ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
18     CT_ASSERT(!std::is_same<Safe, NotSafe>::value);
19     #endif
20 }
21 
22 #define TEST_TRANSACTION_SAFE(not_safe) \
23     test<not_safe BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER, not_safe>()
24 
main()25 int main() {
26 
27     TEST_TRANSACTION_SAFE(int(int) LREF);
28     TEST_TRANSACTION_SAFE(int(*)(int));
29     TEST_TRANSACTION_SAFE(int(int, ...) RREF);
30     TEST_TRANSACTION_SAFE(int(*)(int, ...));
31 
32     struct foo;
33 
34     TEST_TRANSACTION_SAFE(int(foo::*)(int));
35     TEST_TRANSACTION_SAFE(int(foo::*)(int) const);
36     TEST_TRANSACTION_SAFE(int(foo::*)(int, ...));
37     TEST_TRANSACTION_SAFE(int(foo::*)(int, ...) volatile);
38 }
39 
40