[gjs: 9/10] js-value-inl: Only check isnan() on floating point types




commit cb073784f877bb2b4cda73330740efaa8e9c4531
Author: Philip Chimento <philip chimento gmail com>
Date:   Sat Mar 13 11:59:30 2021 -0800

    js-value-inl: Only check isnan() on floating point types
    
    This is an attempt to avoid ambiguity compiler errors on MSVC.
    See: https://gitlab.gnome.org/GNOME/gjs/-/merge_requests/584

 gi/js-value-inl.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gi/js-value-inl.h b/gi/js-value-inl.h
index 7a73b72e..a23d9c63 100644
--- a/gi/js-value-inl.h
+++ b/gi/js-value-inl.h
@@ -213,7 +213,8 @@ GJS_JSAPI_RETURN_CONVENTION inline bool js_value_to_c_checked(
                  *out <
                      static_cast<T>(std::numeric_limits<WantedType>::lowest()));
 
-            if constexpr (std::is_integral_v<WantedType>)
+            if constexpr (std::is_integral_v<WantedType> &&
+                          std::is_floating_point_v<T>)
                 *out_of_range |= std::isnan(*out);
         }
         return ret;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]