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 5 #include <boost/hana/assert.hpp> 6 7 #include <support/cnumeric.hpp> 8 namespace hana = boost::hana; 9 10 11 template <bool value> runtime_bool()12bool runtime_bool() { return value; } 13 14 template <bool value> constant_bool()15auto constant_bool() { return make_cnumeric<bool, value>(); } 16 17 main()18int main() { 19 // Make sure it works at function scope 20 BOOST_HANA_ASSERT(runtime_bool<true>()); 21 BOOST_HANA_ASSERT(constant_bool<true>()); 22 23 BOOST_HANA_ASSERT_MSG(runtime_bool<true>(), "message"); 24 BOOST_HANA_ASSERT_MSG(constant_bool<true>(), "message"); 25 26 // Make sure we can reference a local variable 27 auto ct_yes = constant_bool<true>(); 28 BOOST_HANA_ASSERT(ct_yes); 29 BOOST_HANA_ASSERT_MSG(ct_yes, "message"); 30 31 auto rt_yes = runtime_bool<true>(); 32 BOOST_HANA_ASSERT(rt_yes); 33 BOOST_HANA_ASSERT_MSG(rt_yes, "message"); 34 } 35