| 1 | // Copyright Louis Dionne 2013-2022 |
|---|---|
| 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 | #include <boost/hana/equal.hpp> |
| 7 | #include <boost/hana/optional.hpp> |
| 8 | |
| 9 | #include <laws/base.hpp> |
| 10 | namespace hana = boost::hana; |
| 11 | using hana::test::ct_eq; |
| 12 | |
| 13 | |
| 14 | struct object { |
| 15 | ct_eq<3> member; |
| 16 | }; |
| 17 | |
| 18 | int main() { |
| 19 | auto lvalue = hana::just(object{}); |
| 20 | ct_eq<3>& ref = lvalue->member; |
| 21 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 22 | ref, |
| 23 | ct_eq<3>{} |
| 24 | )); |
| 25 | |
| 26 | auto const const_lvalue = hana::just(object{}); |
| 27 | ct_eq<3> const& const_ref = const_lvalue->member; |
| 28 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 29 | const_ref, |
| 30 | ct_eq<3>{} |
| 31 | )); |
| 32 | |
| 33 | BOOST_HANA_CONSTANT_CHECK(hana::equal( |
| 34 | hana::just(object{})->member, |
| 35 | ct_eq<3>{} |
| 36 | )); |
| 37 | } |
| 38 |
