Skip to content

Commit 82d67eb

Browse files
committed
Fixing Windows
1 parent eb2525d commit 82d67eb

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

tests/test_operator_overloading.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,22 @@ namespace std {
6262
};
6363
}
6464

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
7881
#endif
7982
#endif
8083

@@ -161,4 +164,6 @@ TEST_SUBMODULE(operators, m) {
161164
m.def("get_NestC", [](const NestC &c) { return c.value; });
162165
}
163166

164-
#pragma GCC diagnostic pop
167+
#ifndef _MSC_VER
168+
#pragma GCC diagnostic pop
169+
#endif

0 commit comments

Comments
 (0)