From e5cd7bf85220e93c935eee8f33b34ecb5ca8e094 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 15 Jun 2021 02:25:13 +0300 Subject: [PATCH] Placate g++ 6 and earlier --- test/std_interop_test8.cpp | 26 ++++++++++++++++++++++++++ test/std_interop_test9.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/test/std_interop_test8.cpp b/test/std_interop_test8.cpp index 913afa2..2754a40 100644 --- a/test/std_interop_test8.cpp +++ b/test/std_interop_test8.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) @@ -21,9 +22,34 @@ enum my_errc my_enoent = ENOENT }; +#if defined(BOOST_GCC) && BOOST_GCC < 70000 + +// g++ 6 and earlier do not allow specializations outside the namespace + +namespace boost +{ +namespace system +{ + +template<> struct is_error_condition_enum: std::true_type {}; + +} // namespace system +} // namespace boost + +namespace std +{ + +template<> struct is_error_condition_enum: std::true_type {}; + +} // namespace std + +#else + template<> struct boost::system::is_error_condition_enum: std::true_type {}; template<> struct std::is_error_condition_enum: std::true_type {}; +#endif + boost::system::error_condition make_error_condition( my_errc e ) { return boost::system::error_condition( e, boost::system::generic_category() ); diff --git a/test/std_interop_test9.cpp b/test/std_interop_test9.cpp index 6fae6b5..b869792 100644 --- a/test/std_interop_test9.cpp +++ b/test/std_interop_test9.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) @@ -21,9 +22,34 @@ enum my_errc my_enoent = ENOENT }; +#if defined(BOOST_GCC) && BOOST_GCC < 70000 + +// g++ 6 and earlier do not allow specializations outside the namespace + +namespace boost +{ +namespace system +{ + +template<> struct is_error_code_enum: std::true_type {}; + +} // namespace system +} // namespace boost + +namespace std +{ + +template<> struct is_error_code_enum: std::true_type {}; + +} // namespace std + +#else + template<> struct boost::system::is_error_code_enum: std::true_type {}; template<> struct std::is_error_code_enum: std::true_type {}; +#endif + boost::system::error_code make_error_code( my_errc e ) { return boost::system::error_code( e, boost::system::generic_category() );