Skip to content

Commit 009ffc3

Browse files
authored
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.
1 parent 4b42c37 commit 009ffc3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ jobs:
712712

713713
include:
714714
- python: 3.9
715-
args: -DCMAKE_CXX_STANDARD=20 -DDOWNLOAD_EIGEN=OFF
715+
args: -DCMAKE_CXX_STANDARD=20
716716
- python: 3.8
717717
args: -DCMAKE_CXX_STANDARD=17
718718

@@ -835,7 +835,7 @@ jobs:
835835
cmake -S . -B build
836836
-DPYBIND11_WERROR=ON
837837
-DDOWNLOAD_CATCH=ON
838-
-DDOWNLOAD_EIGEN=OFF
838+
-DDOWNLOAD_EIGEN=ON
839839
-DCMAKE_CXX_STANDARD=20
840840
841841
- name: Build C++20

include/pybind11/detail/common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,9 @@ struct is_template_base_of_impl {
822822
/// Check if a template is the base of a type. For example:
823823
/// `is_template_base_of<Base, T>` is true if `struct T : Base<U> {}` where U can be anything
824824
template <template <typename...> class Base, typename T>
825-
#if defined(PYBIND11_CPP20) || !defined(_MSC_VER) // Sadly, all MSVC versions incl. 2022 need this.
825+
// Sadly, all MSVC versions incl. 2022 need the workaround, even in C++20 mode.
826+
// See also: https://github.com/pybind/pybind11/pull/3741
827+
#if !defined(_MSC_VER)
826828
using is_template_base_of
827829
= decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr));
828830
#else

include/pybind11/eigen.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
// make it version specific, or even remove it later, but considering that
2222
// 1. C4127 is generally far more distracting than useful for modern template code, and
2323
// 2. we definitely want to ignore any MSVC warnings originating from Eigen code,
24-
// it is probably best to keep this around indefinitely.
24+
// it is probably best to keep this around indefinitely.
2525
#if defined(_MSC_VER)
2626
# pragma warning(push)
2727
# pragma warning(disable : 4127) // C4127: conditional expression is constant
28+
# pragma warning(disable : 5054) // https://github.com/pybind/pybind11/pull/3741
29+
// C5054: operator '&': deprecated between enumerations of different types
2830
#endif
2931

3032
#include <Eigen/Core>

0 commit comments

Comments
 (0)