Skip to content

Commit a97e9d8

Browse files
authored
Dropping MSVC 2015 (#3722)
* Changing `_MSC_VER` guard to `< 1910` (dropping MSVC 2015). * Removing MSVC 2015 from ci.yml, and .appveyor.yml entirely. * Bringing back .appveyor.yml from master. * appveyor Visual Studio 2017 * 1st manual pass, builds & tests with unix_clang, before pre-commit. * After clang-format (via pre-commit). * Manual pass looking for "2015", builds & tests with unix_clang, before pre-commit. * Backtracking for include/pybind11 changes in previous commit. git checkout d078658 include/pybind11/attr.h include/pybind11/detail/common.h include/pybind11/functional.h -------------------- CI #4160 errors observed: 2a26873 https://github.com/pybind/pybind11/runs/5168332130?check_suite_focus=true $ grep ' error C' *.txt | sed 's/2022-02-12[^ ]*//' | sed 's/^[0-9][0-9]*//' | sed 's/^.*\.txt: //' | sort | uniqD:\a\pybind11\pybind11\include\pybind11\cast.h(1364,1): error C2752: 'pybind11::detail::type_caster<Eigen::Ref<Eigen::Vector3f,0,pybind11::EigenDStride>,void>': more than one partial specialization matches the template argument list [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj] d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\cross_module_gil_utils.vcxproj] d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\pybind11_cross_module_tests.vcxproj] d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj] d:\a\pybind11\pybind11\include\pybind11\detail/common.h(1023): error C2737: 'pybind11::overload_cast': 'constexpr' object must be initialized [D:\a\pybind11\pybind11\build\tests\test_embed\external_module.vcxproj] D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj] D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] $ grep ': error C2737' *.txt | sed 's/^.*MSVC//' | sed 's/___.*//' | sort | uniq _2017 $ grep ': error C2752' *.txt 3______3.8_____MSVC_2019_____x86_-DCMAKE_CXX_STANDARD=17.txt:2022-02-12T16:12:45.9921122Z D:\a\pybind11\pybind11\include\pybind11\cast.h(1364,1): error C2752: 'pybind11::detail::type_caster<Eigen::Ref<Eigen::Vector3f,0,pybind11::EigenDStride>,void>': more than one partial specialization matches the template argument list [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj] $ grep ': fatal error C1001:' *.txt 10______pypy-3.8-v7.3.7_____windows-2022_____x64.txt:2022-02-12T16:12:56.3163683Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] 1______3.6_____MSVC_2019_____x86.txt:2022-02-12T16:12:47.6774625Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj] 16______3.6_____windows-latest_____x64_-DPYBIND11_FINDPYTHON=ON.txt:2022-02-12T16:12:27.0556151Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] 17______3.9_____windows-2019_____x64.txt:2022-02-12T16:12:30.3822566Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] 2______3.7_____MSVC_2019_____x86.txt:2022-02-12T16:12:38.7018911Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\build\tests\pybind11_tests.vcxproj] 6______3.6_____windows-2022_____x64.txt:2022-02-12T16:12:00.4513642Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] 7______3.9_____windows-2022_____x64.txt:2022-02-12T16:11:43.6306160Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] 8______3.10_____windows-2022_____x64.txt:2022-02-12T16:11:49.9589644Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] 9______pypy-3.7-v7.3.7_____windows-2022_____x64.txt:2022-02-12T16:11:53.7912112Z D:\a\pybind11\pybind11\include\pybind11\detail/common.h(624): fatal error C1001: Internal compiler error. [D:\a\pybind11\pybind11\tests\pybind11_tests.vcxproj] * common.h: is_template_base_of * Re-applying 4 changes from 2a26873 that work universally. * `overload_cast = {};` only for MSVC 2017 and Clang 5 * Refining condition for using is_template_base_of workaround. * Undoing MSVC 2015 workaround in test_constants_and_functions.cpp * CentOS7: silence_unused_warnings * Tweaks in response to reviews. * Adding windows-2022 C++20 * Trying another way of adding windows-2022 C++20
1 parent 4415647 commit a97e9d8

21 files changed

+65
-193
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 1.0.{build}
22
image:
3-
- Visual Studio 2015
3+
- Visual Studio 2017
44
test: off
55
skip_branch_with_pr: true
66
build:
@@ -13,7 +13,7 @@ environment:
1313
CONFIG: Debug
1414
install:
1515
- ps: |
16-
$env:CMAKE_GENERATOR = "Visual Studio 14 2015"
16+
$env:CMAKE_GENERATOR = "Visual Studio 15 2017"
1717
if ($env:PLATFORM -eq "x64") { $env:PYTHON = "$env:PYTHON-x64" }
1818
$env:PATH = "C:\Python$env:PYTHON\;C:\Python$env:PYTHON\Scripts\;$env:PATH"
1919
python -W ignore -m pip install --upgrade pip wheel

.github/workflows/ci.yml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -755,53 +755,6 @@ jobs:
755755
- name: Python tests
756756
run: cmake --build build -t pytest
757757

758-
win32-msvc2015:
759-
name: "🐍 ${{ matrix.python }} • MSVC 2015 • x64"
760-
runs-on: windows-latest
761-
strategy:
762-
fail-fast: false
763-
matrix:
764-
python:
765-
- 3.6
766-
- 3.7
767-
# todo: check/cpptest does not support 3.8+ yet
768-
769-
steps:
770-
- uses: actions/checkout@v2
771-
772-
- name: Setup 🐍 ${{ matrix.python }}
773-
uses: actions/setup-python@v2
774-
with:
775-
python-version: ${{ matrix.python }}
776-
777-
- name: Update CMake
778-
uses: jwlawson/[email protected]
779-
780-
- name: Prepare MSVC
781-
uses: ilammy/[email protected]
782-
with:
783-
toolset: 14.0
784-
785-
- name: Prepare env
786-
run: |
787-
python -m pip install -r tests/requirements.txt
788-
789-
# First build - C++11 mode and inplace
790-
- name: Configure
791-
run: >
792-
cmake -S . -B build
793-
-G "Visual Studio 14 2015" -A x64
794-
-DPYBIND11_WERROR=ON
795-
-DDOWNLOAD_CATCH=ON
796-
-DDOWNLOAD_EIGEN=ON
797-
798-
- name: Build C++14
799-
run: cmake --build build -j 2
800-
801-
- name: Run all checks
802-
run: cmake --build build -t check
803-
804-
805758
win32-msvc2017:
806759
name: "🐍 ${{ matrix.python }} • MSVC 2017 • x64"
807760
runs-on: windows-2016

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Supported compilers
122122
1. Clang/LLVM 3.3 or newer (for Apple Xcode's clang, this is 5.0.0 or
123123
newer)
124124
2. GCC 4.8 or newer
125-
3. Microsoft Visual Studio 2015 Update 3 or newer
125+
3. Microsoft Visual Studio 2017 or newer
126126
4. Intel classic C++ compiler 18 or newer (ICC 20.2 tested in CI)
127127
5. Cygwin/GCC (previously tested on 2.5.1)
128128
6. NVCC (CUDA 11.0 tested in CI)

docs/advanced/cast/stl.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ included to tell pybind11 how to visit the variant.
8787

8888
pybind11 only supports the modern implementation of ``boost::variant``
8989
which makes use of variadic templates. This requires Boost 1.56 or newer.
90-
Additionally, on Windows, MSVC 2017 is required because ``boost::variant``
91-
falls back to the old non-variadic implementation on MSVC 2015.
9290

9391
.. _opaque:
9492

docs/advanced/classes.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,13 +1118,6 @@ described trampoline:
11181118
py::class_<A, Trampoline>(m, "A") // <-- `Trampoline` here
11191119
.def("foo", &Publicist::foo); // <-- `Publicist` here, not `Trampoline`!
11201120
1121-
.. note::
1122-
1123-
MSVC 2015 has a compiler bug (fixed in version 2017) which
1124-
requires a more explicit function binding in the form of
1125-
``.def("foo", static_cast<int (A::*)() const>(&Publicist::foo));``
1126-
where ``int (A::*)() const`` is the type of ``A::foo``.
1127-
11281121
Binding final classes
11291122
=====================
11301123

docs/basics.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ The last line will both compile and run the tests.
3232
Windows
3333
-------
3434

35-
On Windows, only **Visual Studio 2015** and newer are supported since pybind11 relies
36-
on various C++11 language features that break older versions of Visual Studio.
35+
On Windows, only **Visual Studio 2017** and newer are supported.
3736

3837
.. Note::
3938

docs/classes.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,7 @@ you can use ``py::detail::overload_cast_impl`` with an additional set of parenth
434434
.def("set", overload_cast_<int>()(&Pet::set), "Set the pet's age")
435435
.def("set", overload_cast_<const std::string &>()(&Pet::set), "Set the pet's name");
436436
437-
.. [#cpp14] A compiler which supports the ``-std=c++14`` flag
438-
or Visual Studio 2015 Update 2 and newer.
437+
.. [#cpp14] A compiler which supports the ``-std=c++14`` flag.
439438
440439
.. note::
441440

docs/faq.rst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,20 +220,6 @@ In addition to decreasing binary size, ``-fvisibility=hidden`` also avoids
220220
potential serious issues when loading multiple modules and is required for
221221
proper pybind operation. See the previous FAQ entry for more details.
222222

223-
Working with ancient Visual Studio 2008 builds on Windows
224-
=========================================================
225-
226-
The official Windows distributions of Python are compiled using truly
227-
ancient versions of Visual Studio that lack good C++11 support. Some users
228-
implicitly assume that it would be impossible to load a plugin built with
229-
Visual Studio 2015 into a Python distribution that was compiled using Visual
230-
Studio 2008. However, no such issue exists: it's perfectly legitimate to
231-
interface DLLs that are built with different compilers and/or C libraries.
232-
Common gotchas to watch out for involve not ``free()``-ing memory region
233-
that that were ``malloc()``-ed in another shared library, using data
234-
structures with incompatible ABIs, and so on. pybind11 is very careful not
235-
to make these types of mistakes.
236-
237223
How can I properly handle Ctrl-C in long-running functions?
238224
===========================================================
239225

include/pybind11/attr.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ struct base {
6161

6262
PYBIND11_DEPRECATED(
6363
"base<T>() was deprecated in favor of specifying 'T' as a template argument to class_")
64-
base() {} // NOLINT(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
64+
base() = default;
6565
};
6666

6767
/// Keep patient alive while nurse lives
@@ -82,8 +82,7 @@ struct metaclass {
8282
handle value;
8383

8484
PYBIND11_DEPRECATED("py::metaclass() is no longer required. It's turned on by default now.")
85-
// NOLINTNEXTLINE(modernize-use-equals-default): breaks MSVC 2015 when adding an attribute
86-
metaclass() {}
85+
metaclass() = default;
8786

8887
/// Override pybind11's default metaclass
8988
explicit metaclass(handle value) : value(value) {}

include/pybind11/detail/common.h

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
// or newer.
4848
# if _MSVC_LANG >= 201402L
4949
# define PYBIND11_CPP14
50-
# if _MSVC_LANG > 201402L && _MSC_VER >= 1910
50+
# if _MSVC_LANG > 201402L
5151
# define PYBIND11_CPP17
5252
# if _MSVC_LANG >= 202002L
5353
# define PYBIND11_CPP20
@@ -81,10 +81,8 @@
8181
# error pybind11 requires gcc 4.8 or newer
8282
# endif
8383
#elif defined(_MSC_VER)
84-
// Pybind hits various compiler bugs in 2015u2 and earlier, and also makes use of some stl features
85-
// (e.g. std::negation) added in 2015u3:
86-
# if _MSC_FULL_VER < 190024210
87-
# error pybind11 requires MSVC 2015 update 3 or newer
84+
# if _MSC_VER < 1910
85+
# error pybind11 2.10+ requires MSVC 2017 or newer
8886
# endif
8987
#endif
9088

@@ -149,7 +147,7 @@
149147

150148
/* Don't let Python.h #define (v)snprintf as macro because they are implemented
151149
properly in Visual Studio since 2015. */
152-
#if defined(_MSC_VER) && _MSC_VER >= 1900
150+
#if defined(_MSC_VER)
153151
# define HAVE_SNPRINTF 1
154152
#endif
155153

@@ -561,7 +559,7 @@ static_assert(std::is_standard_layout<instance>::value,
561559
"Internal error: `pybind11::detail::instance` is not standard layout!");
562560

563561
/// from __cpp_future__ import (convenient aliases from C++14/17)
564-
#if defined(PYBIND11_CPP14) && (!defined(_MSC_VER) || _MSC_VER >= 1910)
562+
#if defined(PYBIND11_CPP14)
565563
using std::conditional_t;
566564
using std::enable_if_t;
567565
using std::remove_cv_t;
@@ -824,10 +822,10 @@ struct is_template_base_of_impl {
824822
/// Check if a template is the base of a type. For example:
825823
/// `is_template_base_of<Base, T>` is true if `struct T : Base<U> {}` where U can be anything
826824
template <template <typename...> class Base, typename T>
827-
#if !defined(_MSC_VER)
825+
#if defined(PYBIND11_CPP20) || !defined(_MSC_VER) // Sadly, all MSVC versions incl. 2022 need this.
828826
using is_template_base_of
829827
= decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr));
830-
#else // MSVC2015 has trouble with decltype in template aliases
828+
#else
831829
struct is_template_base_of
832830
: decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr)) {
833831
};
@@ -1002,9 +1000,6 @@ struct nodelete {
10021000
PYBIND11_NAMESPACE_BEGIN(detail)
10031001
template <typename... Args>
10041002
struct overload_cast_impl {
1005-
// NOLINTNEXTLINE(modernize-use-equals-default): MSVC 2015 needs this
1006-
constexpr overload_cast_impl() {}
1007-
10081003
template <typename Return>
10091004
constexpr auto operator()(Return (*pf)(Args...)) const noexcept -> decltype(pf) {
10101005
return pf;
@@ -1031,8 +1026,12 @@ PYBIND11_NAMESPACE_END(detail)
10311026
/// - regular: static_cast<Return (Class::*)(Arg0, Arg1, Arg2)>(&Class::func)
10321027
/// - sweet: overload_cast<Arg0, Arg1, Arg2>(&Class::func)
10331028
template <typename... Args>
1029+
# if (defined(_MSC_VER) && _MSC_VER < 1920) /* MSVC 2017 */ \
1030+
|| (defined(__clang__) && __clang_major__ == 5)
10341031
static constexpr detail::overload_cast_impl<Args...> overload_cast = {};
1035-
// MSVC 2015 only accepts this particular initialization syntax for this variable template.
1032+
# else
1033+
static constexpr detail::overload_cast_impl<Args...> overload_cast;
1034+
# endif
10361035
#endif
10371036

10381037
/// Const member function selector for overload_cast
@@ -1118,7 +1117,7 @@ try_get_shared_from_this(std::enable_shared_from_this<T> *holder_value_ptr) {
11181117

11191118
// For silencing "unused" compiler warnings in special situations.
11201119
template <typename... Args>
1121-
#if defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER < 1920 // MSVC 2017
1120+
#if defined(_MSC_VER) && _MSC_VER < 1920 // MSVC 2017
11221121
constexpr
11231122
#endif
11241123
inline void

include/pybind11/functional.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ struct type_caster<std::function<Return(Args...)>> {
9999
Return operator()(Args... args) const {
100100
gil_scoped_acquire acq;
101101
object retval(hfunc.f(std::forward<Args>(args)...));
102-
/* Visual studio 2015 parser issue: need parentheses around this expression */
103-
return (retval.template cast<Return>());
102+
return retval.template cast<Return>();
104103
}
105104
};
106105

tests/pybind11_tests.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
#include <pybind11/eval.h>
44
#include <pybind11/pybind11.h>
55

6-
#if defined(_MSC_VER) && _MSC_VER < 1910
7-
// We get some really long type names here which causes MSVC 2015 to emit warnings
8-
# pragma warning( \
9-
disable : 4503) // NOLINT: warning C4503: decorated name length exceeded, name was truncated
10-
#endif
11-
126
namespace py = pybind11;
137
using namespace pybind11::literals;
148

tests/test_class.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,7 @@ TEST_SUBMODULE(class_, m) {
354354
using ProtectedA::foo;
355355
};
356356

357-
py::class_<ProtectedA>(m, "ProtectedA")
358-
.def(py::init<>())
359-
#if !defined(_MSC_VER) || _MSC_VER >= 1910
360-
.def("foo", &PublicistA::foo);
361-
#else
362-
.def("foo", static_cast<int (ProtectedA::*)() const>(&PublicistA::foo));
363-
#endif
357+
py::class_<ProtectedA>(m, "ProtectedA").def(py::init<>()).def("foo", &PublicistA::foo);
364358

365359
class ProtectedB {
366360
public:
@@ -391,11 +385,7 @@ TEST_SUBMODULE(class_, m) {
391385

392386
py::class_<ProtectedB, TrampolineB>(m, "ProtectedB")
393387
.def(py::init<>())
394-
#if !defined(_MSC_VER) || _MSC_VER >= 1910
395388
.def("foo", &PublicistB::foo);
396-
#else
397-
.def("foo", static_cast<int (ProtectedB::*)() const>(&PublicistB::foo));
398-
#endif
399389

400390
// test_brace_initialization
401391
struct BraceInitialization {

tests/test_const_name.cpp

Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,50 @@
44

55
#include "pybind11_tests.h"
66

7-
#if defined(_MSC_VER) && _MSC_VER < 1910
8-
9-
// MSVC 2015 fails in bizarre ways.
10-
# define PYBIND11_SKIP_TEST_CONST_NAME
11-
12-
#else // Only test with MSVC 2017 or newer.
13-
147
// IUT = Implementation Under Test
15-
# define CONST_NAME_TESTS(TEST_FUNC, IUT) \
16-
std::string TEST_FUNC(int selector) { \
17-
switch (selector) { \
18-
case 0: \
19-
return IUT("").text; \
20-
case 1: \
21-
return IUT("A").text; \
22-
case 2: \
23-
return IUT("Bd").text; \
24-
case 3: \
25-
return IUT("Cef").text; \
26-
case 4: \
27-
return IUT<int>().text; /*NOLINT(bugprone-macro-parentheses)*/ \
28-
case 5: \
29-
return IUT<std::string>().text; /*NOLINT(bugprone-macro-parentheses)*/ \
30-
case 6: \
31-
return IUT<true>("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \
32-
case 7: \
33-
return IUT<false>("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \
34-
case 8: \
35-
/*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
36-
return IUT<true>(IUT("D1"), IUT("D2")).text; \
37-
case 9: \
38-
/*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
39-
return IUT<false>(IUT("E1"), IUT("E2")).text; \
40-
case 10: \
41-
return IUT("KeepAtEnd").text; \
42-
default: \
43-
break; \
44-
} \
45-
throw std::runtime_error("Invalid selector value."); \
46-
}
8+
#define CONST_NAME_TESTS(TEST_FUNC, IUT) \
9+
std::string TEST_FUNC(int selector) { \
10+
switch (selector) { \
11+
case 0: \
12+
return IUT("").text; \
13+
case 1: \
14+
return IUT("A").text; \
15+
case 2: \
16+
return IUT("Bd").text; \
17+
case 3: \
18+
return IUT("Cef").text; \
19+
case 4: \
20+
return IUT<int>().text; /*NOLINT(bugprone-macro-parentheses)*/ \
21+
case 5: \
22+
return IUT<std::string>().text; /*NOLINT(bugprone-macro-parentheses)*/ \
23+
case 6: \
24+
return IUT<true>("T1", "T2").text; /*NOLINT(bugprone-macro-parentheses)*/ \
25+
case 7: \
26+
return IUT<false>("U1", "U2").text; /*NOLINT(bugprone-macro-parentheses)*/ \
27+
case 8: \
28+
/*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
29+
return IUT<true>(IUT("D1"), IUT("D2")).text; \
30+
case 9: \
31+
/*NOLINTNEXTLINE(bugprone-macro-parentheses)*/ \
32+
return IUT<false>(IUT("E1"), IUT("E2")).text; \
33+
case 10: \
34+
return IUT("KeepAtEnd").text; \
35+
default: \
36+
break; \
37+
} \
38+
throw std::runtime_error("Invalid selector value."); \
39+
}
4740

4841
CONST_NAME_TESTS(const_name_tests, py::detail::const_name)
4942

50-
# ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY
43+
#ifdef PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY
5144
CONST_NAME_TESTS(underscore_tests, py::detail::_)
52-
# endif
53-
54-
#endif // MSVC >= 2017
45+
#endif
5546

5647
TEST_SUBMODULE(const_name, m) {
57-
#ifdef PYBIND11_SKIP_TEST_CONST_NAME
58-
m.attr("const_name_tests") = "PYBIND11_SKIP_TEST_CONST_NAME";
59-
#else
6048
m.def("const_name_tests", const_name_tests);
61-
#endif
6249

63-
#ifdef PYBIND11_SKIP_TEST_CONST_NAME
64-
m.attr("underscore_tests") = "PYBIND11_SKIP_TEST_CONST_NAME";
65-
#elif defined(PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY)
50+
#if defined(PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY)
6651
m.def("underscore_tests", underscore_tests);
6752
#else
6853
m.attr("underscore_tests") = "PYBIND11_DETAIL_UNDERSCORE_BACKWARD_COMPATIBILITY not defined.";

0 commit comments

Comments
 (0)