]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/system/test/std_interop_test7.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / system / test / std_interop_test7.cpp
diff --git a/ceph/src/boost/libs/system/test/std_interop_test7.cpp b/ceph/src/boost/libs/system/test/std_interop_test7.cpp
new file mode 100644 (file)
index 0000000..d0fbc8c
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright 2021 Peter Dimov.
+// Distributed under the Boost Software License, Version 1.0.
+// http://www.boost.org/LICENSE_1_0.txt
+
+#include <boost/system/error_code.hpp>
+#include <boost/core/lightweight_test.hpp>
+#include <boost/config/pragma_message.hpp>
+#include <boost/config.hpp>
+#include <cerrno>
+
+#if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
+
+BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" )
+int main() {}
+
+#else
+
+#include <system_error>
+
+int main()
+{
+    {
+        boost::system::error_code e1 = make_error_code( boost::system::errc::bad_address );
+
+        BOOST_TEST( e1 == boost::system::errc::bad_address );
+        BOOST_TEST_NOT( e1 != boost::system::errc::bad_address );
+
+        BOOST_TEST( e1 == std::errc::bad_address );
+        BOOST_TEST_NOT( e1 != std::errc::bad_address );
+    }
+
+    {
+        boost::system::error_code e1 = make_error_code( std::errc::bad_address );
+
+        BOOST_TEST( e1 == boost::system::errc::bad_address );
+        BOOST_TEST_NOT( e1 != boost::system::errc::bad_address );
+
+#if defined(BOOST_GCC) && BOOST_GCC >= 40800 && BOOST_GCC < 50000
+
+// fails on g++ 4.8.5 and g++ 4.9.4 from ubuntu-toolchain-r-test for unknown reasons
+// works on the system g++ 4.8.4 on Trusty and the system g++ 4.8.5 on CentOS 7
+
+#else
+        BOOST_TEST( e1 == std::errc::bad_address );
+        BOOST_TEST_NOT( e1 != std::errc::bad_address );
+#endif
+    }
+
+    return boost::report_errors();
+}
+
+#endif