diff --git a/include/pybind11/eigen.h b/include/pybind11/eigen.h index cc589470f..693a484dc 100644 --- a/include/pybind11/eigen.h +++ b/include/pybind11/eigen.h @@ -22,14 +22,15 @@ # endif #endif -#include -#include - #if defined(_MSC_VER) # pragma warning(push) # pragma warning(disable: 4127) // warning C4127: Conditional expression is constant +# pragma warning(disable: 4996) // warning C4996: std::unary_negate is deprecated in C++17 #endif +#include +#include + // Eigen prior to 3.2.7 doesn't have proper move constructors--but worse, some classes get implicit // move constructors that break things. We could detect this an explicitly copy, but an extra copy // of matrices seems highly undesirable. diff --git a/tests/test_eigen.cpp b/tests/test_eigen.cpp index 20be0aa11..22141df02 100644 --- a/tests/test_eigen.cpp +++ b/tests/test_eigen.cpp @@ -11,6 +11,11 @@ #include "constructor_stats.h" #include #include + +#if defined(_MSC_VER) +# pragma warning(disable: 4996) // C4996: std::unary_negation is deprecated +#endif + #include using MatrixXdR = Eigen::Matrix; diff --git a/tests/test_embed/catch.cpp b/tests/test_embed/catch.cpp index cface485d..236409dbd 100644 --- a/tests/test_embed/catch.cpp +++ b/tests/test_embed/catch.cpp @@ -3,6 +3,12 @@ #include +#ifdef _MSC_VER +// Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch +// 2.0.1; this should be fixed in the next catch release after 2.0.1). +# pragma warning(disable: 4996) +#endif + #define CATCH_CONFIG_RUNNER #include diff --git a/tests/test_embed/test_interpreter.cpp b/tests/test_embed/test_interpreter.cpp index 6b5f051f2..641402d30 100644 --- a/tests/test_embed/test_interpreter.cpp +++ b/tests/test_embed/test_interpreter.cpp @@ -1,4 +1,11 @@ #include + +#ifdef _MSC_VER +// Silence MSVC C++17 deprecation warning from Catch regarding std::uncaught_exceptions (up to catch +// 2.0.1; this should be fixed in the next catch release after 2.0.1). +# pragma warning(disable: 4996) +#endif + #include #include