is_noexcept.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <boost/callable_traits/detail/config.hpp>
  7. #include <boost/callable_traits/is_noexcept.hpp>
  8. #include "test.hpp"
  9. template<typename Noexcept, typename NotNoexcept>
  10. void test() {
  11. CT_ASSERT( is_noexcept<Noexcept>::value
  12. // for old compilers, TEST_NOEXCEPT_QUAL is empty so types are same
  13. || std::is_same<Noexcept, NotNoexcept>::value);
  14. CT_ASSERT(! is_noexcept<NotNoexcept>::value);
  15. }
  16. #define TEST_NOEXCEPT(not_noexcept) test<not_noexcept BOOST_CLBL_TRTS_NOEXCEPT_SPECIFIER, not_noexcept>()
  17. int main() {
  18. TEST_NOEXCEPT(int(*)());
  19. #ifndef BOOST_CLBL_TRTS_DISABLE_ABOMINABLE_FUNCTIONS
  20. TEST_NOEXCEPT(int() const);
  21. TEST_NOEXCEPT(int(...) volatile LREF);
  22. #endif
  23. TEST_NOEXCEPT(int(*)(...));
  24. struct foo;
  25. TEST_NOEXCEPT(int(foo::*)());
  26. TEST_NOEXCEPT(int(foo::*)() const volatile);
  27. TEST_NOEXCEPT(int(foo::*)(...));
  28. TEST_NOEXCEPT(int(foo::*)(...) const volatile RREF);
  29. }