mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-25 14:45:12 +00:00
MSVC C++20 test_eigen (#3741)
* Removing C++20 condition for MSVC is_template_base_of decltype workaround. * `-DDOWNLOAD_EIGEN=ON` for MSVC 2022 C++20 * `-DDOWNLOAD_EIGEN=ON` for MSVC 2019 C++20 * `-DPYBIND11_WERROR=OFF` for MSVC C++20 (2019, 2020) * Restoring `defined(PYBIND11_CPP20)` in common.h * pragma warning(disable : 5054) in eigen.h * Reverting `-DPYBIND11_WERROR=OFF` changes.
This commit is contained in:
parent
4b42c37191
commit
009ffc3362
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -712,7 +712,7 @@ jobs:
|
||||
|
||||
include:
|
||||
- python: 3.9
|
||||
args: -DCMAKE_CXX_STANDARD=20 -DDOWNLOAD_EIGEN=OFF
|
||||
args: -DCMAKE_CXX_STANDARD=20
|
||||
- python: 3.8
|
||||
args: -DCMAKE_CXX_STANDARD=17
|
||||
|
||||
@ -835,7 +835,7 @@ jobs:
|
||||
cmake -S . -B build
|
||||
-DPYBIND11_WERROR=ON
|
||||
-DDOWNLOAD_CATCH=ON
|
||||
-DDOWNLOAD_EIGEN=OFF
|
||||
-DDOWNLOAD_EIGEN=ON
|
||||
-DCMAKE_CXX_STANDARD=20
|
||||
|
||||
- name: Build C++20
|
||||
|
@ -822,7 +822,9 @@ struct is_template_base_of_impl {
|
||||
/// Check if a template is the base of a type. For example:
|
||||
/// `is_template_base_of<Base, T>` is true if `struct T : Base<U> {}` where U can be anything
|
||||
template <template <typename...> class Base, typename T>
|
||||
#if defined(PYBIND11_CPP20) || !defined(_MSC_VER) // Sadly, all MSVC versions incl. 2022 need this.
|
||||
// Sadly, all MSVC versions incl. 2022 need the workaround, even in C++20 mode.
|
||||
// See also: https://github.com/pybind/pybind11/pull/3741
|
||||
#if !defined(_MSC_VER)
|
||||
using is_template_base_of
|
||||
= decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr));
|
||||
#else
|
||||
|
@ -21,10 +21,12 @@
|
||||
// make it version specific, or even remove it later, but considering that
|
||||
// 1. C4127 is generally far more distracting than useful for modern template code, and
|
||||
// 2. we definitely want to ignore any MSVC warnings originating from Eigen code,
|
||||
// it is probably best to keep this around indefinitely.
|
||||
// it is probably best to keep this around indefinitely.
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4127) // C4127: conditional expression is constant
|
||||
# pragma warning(disable : 5054) // https://github.com/pybind/pybind11/pull/3741
|
||||
// C5054: operator '&': deprecated between enumerations of different types
|
||||
#endif
|
||||
|
||||
#include <Eigen/Core>
|
||||
|
Loading…
Reference in New Issue
Block a user