1 /* 2 * (c) Copyright Andrey Semashev 2018. 3 * 4 * Use, modification and distribution are subject to the 5 * Boost Software License, Version 1.0. (See accompanying file 6 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 /* 9 * The test verifies that Boost.Multiprecision does not cause conflict with Boost.Optional 10 * because of its restricted conversion constructors and operators. See comments in: 11 * 12 * https://github.com/boostorg/integer/pull/11 13 */ 14 15 #include <boost/multiprecision/cpp_int.hpp> 16 #include <boost/optional/optional.hpp> 17 #include <boost/core/lightweight_test.hpp> 18 foo()19inline boost::optional<boost::multiprecision::int128_t> foo() 20 { 21 return boost::optional<boost::multiprecision::int128_t>(10); 22 } 23 main()24int main() 25 { 26 boost::optional<boost::multiprecision::int128_t> num = foo(); 27 BOOST_TEST(!!num); 28 BOOST_TEST(*num == 10); 29 30 return boost::report_errors(); 31 } 32