1// Copyright 2021 Peter Dimov.
2// Distributed under the Boost Software License, Version 1.0.
3// https://www.boost.org/LICENSE_1_0.txt
4
5#include <boost/system/result.hpp>
6#include <boost/core/lightweight_test_trait.hpp>
7#include <type_traits>
8
9using namespace boost::system;
10
11int main()
12{
13 BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<int>>));
14 BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int>, errc::errc_t>));
15
16 BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<double>>));
17 BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<double>, errc::errc_t>));
18
19 BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<bool>>));
20 BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<bool>, errc::errc_t>));
21
22 BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<int const&>>));
23 BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int const&>, errc::errc_t>));
24
25 BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<double const&>>));
26 BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<double const&>, errc::errc_t>));
27
28 BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<bool const&>>));
29 BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<bool const&>, errc::errc_t>));
30
31 return boost::report_errors();
32}
33

source code of boost/libs/system/test/result_errc_construct.cpp