From 1378bd263f912c006bb8b7257d1776d10d4fdf21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Sun, 26 Dec 2021 22:05:26 +0100 Subject: [PATCH] Fixes #48 ("MSVC warning C4643: Forward declaring 'nothrow_t' in namespace std is not permitted by the C++ Standard") --- doc/move.qbk | 7 +++++++ include/boost/move/detail/std_ns_begin.hpp | 6 +++++- include/boost/move/detail/std_ns_end.hpp | 2 ++ include/boost/move/make_unique.hpp | 10 ++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/move.qbk b/doc/move.qbk index 52156e9..9a13ab1 100644 --- a/doc/move.qbk +++ b/doc/move.qbk @@ -802,6 +802,13 @@ Special thanks to: [section:release_notes Release Notes] +[section:release_notes_boost_1_79 Boost 1.79 Release] + +* Fixed bugs: + * [@https://github.com/boostorg/move/issues/48 Git Issue #48: ['"MSVC warning C4643: Forward declaring 'nothrow_t' in namespace std is not permitted by the C++ Standard"]]. + +[endsect] + [section:release_notes_boost_1_78 Boost 1.78 Release] * Fixed bugs: diff --git a/include/boost/move/detail/std_ns_begin.hpp b/include/boost/move/detail/std_ns_begin.hpp index a768e61..1d28117 100644 --- a/include/boost/move/detail/std_ns_begin.hpp +++ b/include/boost/move/detail/std_ns_begin.hpp @@ -24,7 +24,11 @@ #define BOOST_MOVE_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std) #define BOOST_MOVE_STD_NS_END _GLIBCXX_END_NAMESPACE #else + #if defined(_MSC_VER) && (_MSC_VER >= 1915) + #pragma warning (push) + #pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard + #endif + #define BOOST_MOVE_STD_NS_BEG namespace std{ #define BOOST_MOVE_STD_NS_END } #endif - diff --git a/include/boost/move/detail/std_ns_end.hpp b/include/boost/move/detail/std_ns_end.hpp index 0975059..61af2d7 100644 --- a/include/boost/move/detail/std_ns_end.hpp +++ b/include/boost/move/detail/std_ns_end.hpp @@ -11,4 +11,6 @@ #ifdef BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH #pragma GCC diagnostic pop #undef BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH +#elif defined(_MSC_VER) && (_MSC_VER >= 1915) + #pragma warning (pop) #endif //BOOST_MOVE_STD_NS_GCC_DIAGNOSTIC_PUSH diff --git a/include/boost/move/make_unique.hpp b/include/boost/move/make_unique.hpp index ef106db..2d421fc 100644 --- a/include/boost/move/make_unique.hpp +++ b/include/boost/move/make_unique.hpp @@ -38,12 +38,22 @@ #if !defined(BOOST_MOVE_DOXYGEN_INVOKED) +#if defined(_MSC_VER) && (_MSC_VER >= 1915) + #pragma warning (push) + #pragma warning (disable : 4643) // Forward declaring 'X' in namespace std is not permitted by the C++ Standard +#endif + namespace std { //no namespace versioning in clang+libc++ struct nothrow_t; } //namespace std { +#if defined(_MSC_VER) && (_MSC_VER >= 1915) + #pragma warning (pop) +#endif + + namespace boost{ namespace move_upmu {