Skip to content

Commit a799fcd

Browse files
committed
Adding pragma warning(disable: 4522) for MSVC <= 2017.
1 parent ff97f10 commit a799fcd

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/pybind11/pybind11.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
# pragma warning(disable: 4100) // warning C4100: Unreferenced formal parameter
2020
# pragma warning(disable: 4127) // warning C4127: Conditional expression is constant
2121
# pragma warning(disable: 4800) // warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning)
22-
# pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified
2322
# pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
2423
#elif defined(__GNUG__) && !defined(__clang__)
2524
# pragma GCC diagnostic push

include/pybind11/pytypes.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ object object_or_cast(T &&o);
532532
// Match a PyObject*, which we want to convert directly to handle via its converting constructor
533533
inline handle object_or_cast(PyObject *ptr) { return ptr; }
534534

535+
#if defined(_MSC_VER) && _MSC_VER < 1920
536+
# pragma warning(push)
537+
# pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified
538+
#endif
535539
template <typename Policy>
536540
class accessor : public object_api<accessor<Policy>> {
537541
using key_type = typename Policy::key_type;
@@ -580,6 +584,9 @@ class accessor : public object_api<accessor<Policy>> {
580584
key_type key;
581585
mutable object cache;
582586
};
587+
#if defined(_MSC_VER) && _MSC_VER < 1920
588+
# pragma warning(pop)
589+
#endif
583590

584591
PYBIND11_NAMESPACE_BEGIN(accessor_policies)
585592
struct obj_attr {

0 commit comments

Comments
 (0)