addressof_constexpr_test.cpp 451 B

1234567891011121314151617181920
  1. /*
  2. Copyright 2017 Glen Joseph Fernandes
  3. (glenjofe@gmail.com)
  4. Distributed under the Boost Software License, Version 1.0.
  5. (http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <boost/core/addressof.hpp>
  8. #include <boost/static_assert.hpp>
  9. #if !defined(BOOST_CORE_NO_CONSTEXPR_ADDRESSOF)
  10. struct Type { };
  11. static int v1 = 0;
  12. static Type v2 = { };
  13. BOOST_STATIC_ASSERT(boost::addressof(v1) == &v1);
  14. BOOST_STATIC_ASSERT(boost::addressof(v2) == &v2);
  15. #endif