From c5eb940ccff9541cd9a00a6a898d6dbef62b4f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 7 Mar 2024 18:14:14 +0100 Subject: [PATCH] python: suppress a useless MSVC warning. --- src/python/magnum/trade.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/python/magnum/trade.cpp b/src/python/magnum/trade.cpp index 6ffd056..0a6d3d3 100644 --- a/src/python/magnum/trade.cpp +++ b/src/python/magnum/trade.cpp @@ -96,8 +96,17 @@ template::type baseCustomValue> inline to pass them all, and I'd need to make my own handling of the OOB cases anyway */ template::type baseCustomValue> void enumWithCustomValues(py::enum_& enum_) { + /* "warning C4310: cast truncates constant value". No shit?! That's + precisely what is this testing for. */ + #ifdef CORRADE_TARGET_MSVC + #pragma warning(push) + #pragma warning(disable: 4310) + #endif static_assert(!typename std::underlying_type::type(baseCustomValue << 1), "base custom value expected to be a single highest bit"); + #ifdef CORRADE_TARGET_MSVC + #pragma warning(pop) + #endif enum_ .def("CUSTOM", [](typename std::underlying_type::type value) {