mirror of
https://github.com/pybind/pybind11.git
synced 2026-05-11 17:00:34 +00:00
Add -Wdeprecated to test suite and fix associated warnings (#1191)
This commit turns on `-Wdeprecated` in the test suite and fixes several associated deprecation warnings that show up as a result: - in C++17 `static constexpr` members are implicitly inline; our redeclaration (needed for C++11/14) is deprecated in C++17. - various test suite classes have destructors and rely on implicit copy constructors, but implicit copy constructor definitions when a user-declared destructor is present was deprecated in C++11. - Eigen also has various implicit copy constructors, so just disable `-Wdeprecated` in `eigen.h`.
This commit is contained in:
committed by
Jason Rhinelander
parent
15e0e44549
commit
ba33b2fc79
@@ -25,9 +25,13 @@ template <typename T> struct format_descriptor<std::complex<T>, detail::enable_i
|
||||
static std::string format() { return std::string(value); }
|
||||
};
|
||||
|
||||
#ifndef PYBIND11_CPP17
|
||||
|
||||
template <typename T> constexpr const char format_descriptor<
|
||||
std::complex<T>, detail::enable_if_t<std::is_floating_point<T>::value>>::value[3];
|
||||
|
||||
#endif
|
||||
|
||||
NAMESPACE_BEGIN(detail)
|
||||
|
||||
template <typename T> struct is_fmt_numeric<std::complex<T>, detail::enable_if_t<std::is_floating_point<T>::value>> {
|
||||
|
||||
@@ -704,9 +704,13 @@ template <typename T> struct format_descriptor<T, detail::enable_if_t<std::is_ar
|
||||
static std::string format() { return std::string(1, c); }
|
||||
};
|
||||
|
||||
#if !defined(PYBIND11_CPP17)
|
||||
|
||||
template <typename T> constexpr const char format_descriptor<
|
||||
T, detail::enable_if_t<std::is_arithmetic<T>::value>>::value[2];
|
||||
|
||||
#endif
|
||||
|
||||
/// RAII wrapper that temporarily clears any Python error state
|
||||
struct error_scope {
|
||||
PyObject *type, *value, *trace;
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wconversion"
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
# ifdef __clang__
|
||||
// Eigen generates a bunch of implicit-copy-constructor-is-deprecated warnings with -Wdeprecated
|
||||
// under Clang, so disable that warning here:
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated"
|
||||
# endif
|
||||
# if __GNUC__ >= 7
|
||||
# pragma GCC diagnostic ignored "-Wint-in-bool-context"
|
||||
# endif
|
||||
|
||||
@@ -295,6 +295,9 @@ public:
|
||||
PyErr_Fetch(&type.ptr(), &value.ptr(), &trace.ptr());
|
||||
}
|
||||
|
||||
error_already_set(const error_already_set &) = default;
|
||||
error_already_set(error_already_set &&) = default;
|
||||
|
||||
inline ~error_already_set();
|
||||
|
||||
/// Give the currently-held error back to Python, if any. If there is currently a Python error
|
||||
|
||||
Reference in New Issue
Block a user