Skip to content

Commit ef106c8

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

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
@@ -20,7 +20,6 @@
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)
2222
# pragma warning(disable: 4996) // warning C4996: The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name
23-
# pragma warning(disable: 4522) // warning C4522: multiple assignment operators specified
2423
# pragma warning(disable: 4505) // warning C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
2524
#elif defined(__GNUG__) && !defined(__clang__)
2625
# 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)