runtime.cpp 664 B

12345678910111213141516171819202122
  1. // Copyright Louis Dionne 2013-2017
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  4. #include <boost/hana/assert.hpp>
  5. namespace hana = boost::hana;
  6. template <bool value>
  7. bool runtime_bool() { return value; }
  8. int main() {
  9. // Make sure it works at function scope
  10. BOOST_HANA_RUNTIME_ASSERT(runtime_bool<true>());
  11. BOOST_HANA_RUNTIME_ASSERT_MSG(runtime_bool<true>(), "message");
  12. // Make sure we can reference a local variable
  13. auto yes = runtime_bool<true>();
  14. BOOST_HANA_RUNTIME_ASSERT(yes);
  15. BOOST_HANA_RUNTIME_ASSERT_MSG(yes, "message");
  16. }