diff --git a/Foundation/include/Poco/Dynamic/VarHolder.h b/Foundation/include/Poco/Dynamic/VarHolder.h index 05138430da..f6987b283a 100644 --- a/Foundation/include/Poco/Dynamic/VarHolder.h +++ b/Foundation/include/Poco/Dynamic/VarHolder.h @@ -425,15 +425,33 @@ class Foundation_API VarHolder template void checkUpperLimitFloat(const F& from) const { - if (from > std::numeric_limits::max()) - throw RangeException("Value too large."); + if (std::is_floating_point::value) + { + if (from > std::numeric_limits::max()) + throw RangeException("Value too large."); + } + else + { + // Avoid clang -Wimplicit-int-float-conversion warning with an explicit cast. + if (from > static_cast(std::numeric_limits::max())) + throw RangeException("Value too large."); + } } template void checkLowerLimitFloat(const F& from) const { - if (from < -std::numeric_limits::max()) - throw RangeException("Value too small."); + if (std::is_floating_point::value) + { + if (from < -std::numeric_limits::max()) + throw RangeException("Value too small."); + } + else + { + // Avoid clang -Wimplicit-int-float-conversion warning with an explicit cast. + if (from < static_cast(std::numeric_limits::min())) + throw RangeException("Value too small."); + } } template