1// Copyright 2021 Peter Dimov.
2// Distributed under the Boost Software License, Version 1.0.
3// http://www.boost.org/LICENSE_1_0.txt
4
5#include <boost/system/error_code.hpp>
6#include <boost/core/lightweight_test.hpp>
7#include <boost/config.hpp>
8#include <cerrno>
9#include <system_error>
10
11int main()
12{
13 {
14 boost::system::error_code e1 = make_error_code( e: boost::system::errc::bad_address );
15
16 BOOST_TEST( e1 == boost::system::errc::bad_address );
17 BOOST_TEST_NOT( e1 != boost::system::errc::bad_address );
18
19 BOOST_TEST( e1 == std::errc::bad_address );
20 BOOST_TEST_NOT( e1 != std::errc::bad_address );
21 }
22
23 {
24 boost::system::error_code e1 = make_error_code( e: std::errc::bad_address );
25
26 BOOST_TEST( e1 == boost::system::errc::bad_address );
27 BOOST_TEST_NOT( e1 != boost::system::errc::bad_address );
28
29#if defined(BOOST_GCC) && BOOST_GCC >= 40800 && BOOST_GCC < 50000
30
31// fails on g++ 4.8.5 and g++ 4.9.4 from ubuntu-toolchain-r-test for unknown reasons
32// works on the system g++ 4.8.4 on Trusty and the system g++ 4.8.5 on CentOS 7
33
34#else
35 BOOST_TEST( e1 == std::errc::bad_address );
36 BOOST_TEST_NOT( e1 != std::errc::bad_address );
37#endif
38 }
39
40 return boost::report_errors();
41}
42

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