git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
C++: clean up int cast warning found with Xcode
2f95c79Andy Arvanitis
pcc/runtime/purescript.hh+4−3
@@ -19,7 +19,7 @@
19
19
20#if defined(DEBUG)
20#if defined(DEBUG)
21 #include <cassert>
21 #include <cassert>
22− #include <climits>
22+ #include <limits>
23 #define IF_DEBUG(x) x
23 #define IF_DEBUG(x) x
24#else
24#else
25 #define NDEBUG
25 #define NDEBUG
@@ -165,8 +165,9 @@ class any {
165 public:
165 public:
166
166
167 any(const int val) noexcept : tag(tag_t::Integer), i(val) {}
167 any(const int val) noexcept : tag(tag_t::Integer), i(val) {}
168− any(const long int_value) noexcept : tag(tag_t::Integer), i(int_value) {
168+ any(const long val) noexcept : tag(tag_t::Integer), i(static_cast<decltype(i)>(val)) {
169− assert(int_value >= INT_MIN && int_value <= INT_MAX);
169+ assert(val >= std::numeric_limits<decltype(i)>::min() &&
170+ val <= std::numeric_limits<decltype(i)>::max());
170 }
171 }
171
172
172 any(const double val) noexcept : tag(tag_t::Double), d(val) {}
173 any(const double val) noexcept : tag(tag_t::Double), d(val) {}