From d4614204e56e518752a93e8621dadc6fabed3cd8 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sat, 6 Jan 2024 07:42:32 +0200 Subject: [PATCH] Suppress MSVC warnings --- include/boost/bind/bind.hpp | 9 +++++++++ test/bind_void_test.cpp | 2 +- test/protect_test2.cpp | 6 ++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/boost/bind/bind.hpp b/include/boost/bind/bind.hpp index 7600077..bda1263 100644 --- a/include/boost/bind/bind.hpp +++ b/include/boost/bind/bind.hpp @@ -172,6 +172,11 @@ public: list( A... a ): data_( a... ) {} +#if BOOST_MSVC +# pragma warning( push ) +# pragma warning( disable: 4100 ) // unreferenced formal parameter 'a2' +#endif + template R call_impl( type, F & f, A2 & a2, _bi::index_sequence ) { return unwrapper::unwrap( f, 0 )( a2[ std::get( data_ ) ]... ); @@ -192,6 +197,10 @@ public: unwrapper::unwrap( f, 0 )( a2[ std::get( data_ ) ]... ); } +#if BOOST_MSVC +# pragma warning( pop ) +#endif + // template R operator()( type, F & f, A2 & a2 ) diff --git a/test/bind_void_test.cpp b/test/bind_void_test.cpp index 37a72e0..acc53d7 100644 --- a/test/bind_void_test.cpp +++ b/test/bind_void_test.cpp @@ -100,7 +100,7 @@ void function_test() struct Y { - short operator()(short & r) const { return global_result = ++r; } + short operator()(short & r) const { return static_cast( global_result = ++r ); } int operator()(int a, int b) const { return global_result = a + 10 * b; } long operator() (long a, long b, long c) const { return global_result = a + 10 * b + 100 * c; } void operator() (long a, long b, long c, long d) const { global_result = a + 10 * b + 100 * c + 1000 * d; } diff --git a/test/protect_test2.cpp b/test/protect_test2.cpp index 3ca9c46..6d17bf1 100644 --- a/test/protect_test2.cpp +++ b/test/protect_test2.cpp @@ -6,6 +6,12 @@ #include #include +#include + +#if defined(BOOST_MSVC) +# pragma warning( disable: 4510 ) // default constructor could not be generated +# pragma warning( disable: 4610 ) // class can never be instantiated - constructor required +#endif template void test( F ) {