Add negative test for constructing result<int> from errc_t (refs #74)

This commit is contained in:
Peter Dimov
2021-12-09 20:19:05 +02:00
parent 91c0dd9a74
commit 8c9ceba775
2 changed files with 24 additions and 0 deletions

View File

@ -154,3 +154,4 @@ run result_eq.cpp : : : $(CPP11) ;
run result_range_for.cpp : : : $(CPP11) ;
run result_value_construct2.cpp : : : $(CPP11) ;
run result_error_construct2.cpp : : : $(CPP11) ;
run result_errc_construct.cpp : : : $(CPP11) ;

View File

@ -0,0 +1,23 @@
// Copyright 2021 Peter Dimov.
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/system/result.hpp>
#include <boost/core/lightweight_test_trait.hpp>
#include <type_traits>
using namespace boost::system;
int main()
{
BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<int>>));
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<int>, errc::errc_t>));
BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<double>>));
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<double>, errc::errc_t>));
BOOST_TEST_TRAIT_FALSE((std::is_convertible<errc::errc_t, result<bool>>));
BOOST_TEST_TRAIT_FALSE((std::is_constructible<result<bool>, errc::errc_t>));
return boost::report_errors();
}