]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/hana/test/assert/constexpr.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / hana / test / assert / constexpr.cpp
CommitLineData
b32b8144 1// Copyright Louis Dionne 2013-2017
7c673cae
FG
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>
6namespace hana = boost::hana;
7
8
9template <bool value>
10bool runtime_bool() { return value; }
11
12template <bool value>
13constexpr bool constexpr_bool() { return value; }
14
15
16int main() {
17 // Make sure it works at function scope
18 BOOST_HANA_CONSTEXPR_ASSERT(runtime_bool<true>());
19 BOOST_HANA_CONSTEXPR_ASSERT(constexpr_bool<true>());
20 BOOST_HANA_CONSTEXPR_ASSERT_MSG(runtime_bool<true>(), "message");
21 BOOST_HANA_CONSTEXPR_ASSERT_MSG(constexpr_bool<true>(), "message");
22
23 // Make sure we can reference a local variable
24 auto rt_yes = runtime_bool<true>();
25 constexpr auto cx_yes = constexpr_bool<true>();
26 BOOST_HANA_CONSTEXPR_ASSERT(rt_yes);
27 BOOST_HANA_CONSTEXPR_ASSERT(cx_yes);
28 BOOST_HANA_CONSTEXPR_ASSERT_MSG(rt_yes, "message");
29 BOOST_HANA_CONSTEXPR_ASSERT_MSG(cx_yes, "message");
30}