Skip to content

Commit

Permalink
Add C4275 warning suppressions for _MSC_VER
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Oct 24, 2022
1 parent c9abf79 commit f381a34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/cross_module_exception_odr_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@

namespace cross_module_exception_odr {

#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4275)
#endif

class PYBIND11_EXPORT_EXCEPTION evolving : public std::runtime_error {
public:
explicit evolving(const std::string &msg) : std::runtime_error("v1:" + msg) {}
};

#if defined(_MSC_VER)
# pragma warning(pop)
#endif

} // namespace cross_module_exception_odr

PYBIND11_MODULE(cross_module_exception_odr_1, m) {
Expand Down
9 changes: 9 additions & 0 deletions tests/cross_module_exception_odr_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,20 @@

namespace cross_module_exception_odr {

#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4275)
#endif

class PYBIND11_EXPORT_EXCEPTION evolving : public std::exception {
public:
const char *what() const noexcept override { return "v2"; }
};

#if defined(_MSC_VER)
# pragma warning(pop)
#endif

void raise_evolving_from_module_2() { throw evolving(); }

} // namespace cross_module_exception_odr
Expand Down

0 comments on commit f381a34

Please sign in to comment.