@@ -62,19 +62,22 @@ namespace std {
62
62
};
63
63
}
64
64
65
- #pragma GCC diagnostic push
66
- // clang 7.0.0 and Apple LLVM 10.0.1 introduce `-Wself-assign-overloaded` to
67
- // `-Wall`, which is used here for overloading (e.g. `py::self += py::self `).
68
- // Here, we suppress the warning using `#pragma diagnostic`.
69
- // Taken from: https://github.com/RobotLocomotion/drake/commit/aaf84b46
70
- // TODO(eric): This could be resolved using a function / functor (e.g. `py::self()`).
71
- #if (__APPLE__) && (__clang__)
72
- #if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
73
- #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
74
- #endif
75
- #elif (__clang__)
76
- #if (__clang_major__ >= 7)
77
- #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
65
+ // MSVC warns about unknown pragmas, and warnings are errors.
66
+ #ifndef _MSC_VER
67
+ #pragma GCC diagnostic push
68
+ // clang 7.0.0 and Apple LLVM 10.0.1 introduce `-Wself-assign-overloaded` to
69
+ // `-Wall`, which is used here for overloading (e.g. `py::self += py::self `).
70
+ // Here, we suppress the warning using `#pragma diagnostic`.
71
+ // Taken from: https://github.com/RobotLocomotion/drake/commit/aaf84b46
72
+ // TODO(eric): This could be resolved using a function / functor (e.g. `py::self()`).
73
+ #if (__APPLE__) && (__clang__)
74
+ #if (__clang_major__ >= 10) && (__clang_minor__ >= 0) && (__clang_patchlevel__ >= 1)
75
+ #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
76
+ #endif
77
+ #elif (__clang__)
78
+ #if (__clang_major__ >= 7)
79
+ #pragma GCC diagnostic ignored "-Wself-assign-overloaded"
80
+ #endif
78
81
#endif
79
82
#endif
80
83
@@ -161,4 +164,6 @@ TEST_SUBMODULE(operators, m) {
161
164
m.def (" get_NestC" , [](const NestC &c) { return c.value ; });
162
165
}
163
166
164
- #pragma GCC diagnostic pop
167
+ #ifndef _MSC_VER
168
+ #pragma GCC diagnostic pop
169
+ #endif
0 commit comments