Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / test / assert / lambdas.cpp
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 // This test makes sure that we can use lambdas inside the various
12 // BOOST_HANA_XXX_ASSERT macros.
13
14 template <bool value>
15 bool runtime_bool() { return value; }
16
17 template <bool value>
18 auto constant_bool() { return make_cnumeric<bool, value>(); }
19
20 int main() {
21     BOOST_HANA_CONSTANT_ASSERT([]{ return constant_bool<true>(); }());
22     BOOST_HANA_RUNTIME_ASSERT([]{ return runtime_bool<true>(); }());
23     BOOST_HANA_ASSERT([] { return constant_bool<true>(); }());
24     BOOST_HANA_ASSERT([] { return runtime_bool<true>(); }());
25 }