remove_transaction_safe.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*<-
  2. Copyright (c) 2016 Barrett Adair
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  5. ->*/
  6. #include "test.hpp"
  7. #include <boost/callable_traits/remove_transaction_safe.hpp>
  8. template<typename Safe, typename NotSafe>
  9. void test() {
  10. CT_ASSERT(std::is_same<NotSafe, TRAIT(remove_transaction_safe, Safe)>::value);
  11. //sanity check
  12. #ifdef BOOST_CLBL_TRTS_ENABLE_TRANSACTION_SAFE
  13. CT_ASSERT(!std::is_same<Safe, NotSafe>::value);
  14. #endif
  15. }
  16. #define TEST_TRANSACTION_SAFE(not_safe) \
  17. test<not_safe BOOST_CLBL_TRTS_TRANSACTION_SAFE_SPECIFIER, not_safe>()
  18. int main() {
  19. TEST_TRANSACTION_SAFE(int(int) LREF);
  20. TEST_TRANSACTION_SAFE(int(*)(int));
  21. TEST_TRANSACTION_SAFE(int(int, ...) RREF);
  22. TEST_TRANSACTION_SAFE(int(*)(int, ...));
  23. struct foo;
  24. TEST_TRANSACTION_SAFE(int(foo::*)(int));
  25. TEST_TRANSACTION_SAFE(int(foo::*)(int) const);
  26. TEST_TRANSACTION_SAFE(int(foo::*)(int, ...));
  27. TEST_TRANSACTION_SAFE(int(foo::*)(int, ...) volatile);
  28. }