From 83b2c0ddd983c0a685ca91fe545930723b3e13fe Mon Sep 17 00:00:00 2001 From: Gabriel Marks Date: Fri, 29 Oct 2021 21:07:18 +0000 Subject: SERVER-60199 Attempt to fix Coverity defect --- src/mongo/bson/bsonelement.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h index e4485d19233..e519152202b 100644 --- a/src/mongo/bson/bsonelement.h +++ b/src/mongo/bson/bsonelement.h @@ -1056,7 +1056,8 @@ Status BSONElement::tryCoerce(T* out) const { if (!std::isfinite(d)) { return {ErrorCodes::BadValue, "Unable to coerce NaN/Inf to integral type"}; } - bool sameMax = std::numeric_limits::max() == std::numeric_limits::max(); + constexpr bool sameMax = + std::numeric_limits::max() == std::numeric_limits::max(); if ((!sameMax && d > static_cast(std::numeric_limits::max())) || (sameMax && d >= static_cast(std::numeric_limits::max())) || (d < std::numeric_limits::lowest())) { -- cgit v1.2.1