From bb0c6381f640d3a5c74511689dbb9af8d1aba36c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Tue, 5 Oct 2021 08:04:01 +0300 Subject: [PATCH] Add msvc workarounds --- include/boost/core/type_name.hpp | 23 +++++++++++++++++++++++ test/type_name_test.cpp | 14 +++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/include/boost/core/type_name.hpp b/include/boost/core/type_name.hpp index d873df1..c0ec611 100644 --- a/include/boost/core/type_name.hpp +++ b/include/boost/core/type_name.hpp @@ -396,6 +396,8 @@ template std::string type_name( tn_identity, std:: return function_type_name( tn_identity(), "", suffix ); } +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1900 + template std::string type_name( tn_identity, std::string const& suffix ) { return function_type_name( tn_identity(), " const", suffix ); @@ -411,6 +413,8 @@ template std::string type_name( tn_identity(), " const volatile", suffix ); } +#endif + #if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) template std::string type_name( tn_identity, std::string const& suffix ) @@ -619,6 +623,25 @@ template std::string type_name( tn_identity, std::stri return type_name( tn_identity(), ' ' + type_name( tn_identity(), "" ) + "::*" + suffix ); } +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1900 && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const", ' ' + type_name( tn_identity(), "" ) + "::*" + suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " volatile", ' ' + type_name( tn_identity(), "" ) + "::*" + suffix ); +} + +template std::string type_name( tn_identity, std::string const& suffix ) +{ + return function_type_name( tn_identity(), " const volatile", ' ' + type_name( tn_identity(), "" ) + "::*" + suffix ); +} + +#endif + // nullptr_t #if !defined(BOOST_NO_CXX11_NULLPTR) diff --git a/test/type_name_test.cpp b/test/type_name_test.cpp index 4c60fda..e6574cb 100644 --- a/test/type_name_test.cpp +++ b/test/type_name_test.cpp @@ -155,10 +155,14 @@ int main() #endif +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1900 + TEST(void() const); TEST(void() volatile); TEST(void() const volatile); +#endif + #if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) TEST(void() &); @@ -192,14 +196,16 @@ int main() #endif -#endif +#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) TEST(A[]); TEST(A const[]); TEST(A volatile[]); TEST(A const volatile[]); +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1500 TEST(A(&)[]); +#endif TEST(A const(***)[]); TEST(B[1]); @@ -213,7 +219,9 @@ int main() TEST(A[][2][3]); TEST(A const[][2][3]); +#if !defined(BOOST_MSVC) || BOOST_MSVC >= 1500 TEST(A(&)[][2][3]); +#endif TEST(A const(***)[][2][3]); TEST(B[1][2][3]); @@ -225,11 +233,15 @@ int main() TEST(int A::*); TEST(int const B::*); +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + TEST(void(A::*)()); TEST(void(A::*)() const); TEST(void(A::*)() volatile); TEST(void(A::*)() const volatile); +#endif + #if !defined(BOOST_NO_CXX11_REF_QUALIFIERS) TEST(void(A::*)() &);