Browse Source

python: suppress a useless MSVC warning.

next
Vladimír Vondruš 2 years ago
parent
commit
c5eb940ccf
  1. 9
      src/python/magnum/trade.cpp

9
src/python/magnum/trade.cpp

@ -96,8 +96,17 @@ template<class T, typename std::underlying_type<T>::type baseCustomValue> inline
to pass them all, and I'd need to make my own handling of the OOB cases to pass them all, and I'd need to make my own handling of the OOB cases
anyway */ anyway */
template<class T, typename std::underlying_type<T>::type baseCustomValue> void enumWithCustomValues(py::enum_<T>& enum_) { template<class T, typename std::underlying_type<T>::type baseCustomValue> void enumWithCustomValues(py::enum_<T>& 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<T>::type(baseCustomValue << 1), static_assert(!typename std::underlying_type<T>::type(baseCustomValue << 1),
"base custom value expected to be a single highest bit"); "base custom value expected to be a single highest bit");
#ifdef CORRADE_TARGET_MSVC
#pragma warning(pop)
#endif
enum_ enum_
.def("CUSTOM", [](typename std::underlying_type<T>::type value) { .def("CUSTOM", [](typename std::underlying_type<T>::type value) {

Loading…
Cancel
Save