summaryrefslogtreecommitdiff
path: root/absl/random
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-03-30 12:09:23 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2023-03-30 12:10:15 -0700
commitd79361faf639618b501312a5dcdefeaa5bbadfd8 (patch)
tree123223f316f3c7064ec4919271643bfcd6b0beb4 /absl/random
parent2d31912897d4b4a72424368154d37f05c93677cb (diff)
Changes necessary to support clang-cl
This change fixes -Wimplicit-const-int-float-conversion warnings by making the conversions explicit. PiperOrigin-RevId: 520707623 Change-Id: Ib6917469120cd7458257195cbf39beb3fd397543
Diffstat (limited to 'absl/random')
-rw-r--r--absl/random/internal/iostream_state_saver_test.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/random/internal/iostream_state_saver_test.cc b/absl/random/internal/iostream_state_saver_test.cc
index 6e66266c..ea9d2af0 100644
--- a/absl/random/internal/iostream_state_saver_test.cc
+++ b/absl/random/internal/iostream_state_saver_test.cc
@@ -345,8 +345,9 @@ TEST(IOStreamStateSaver, RoundTripLongDoubles) {
}
// Avoid undefined behavior (overflow/underflow).
- if (dd <= std::numeric_limits<int64_t>::max() &&
- dd >= std::numeric_limits<int64_t>::lowest()) {
+ if (dd <= static_cast<long double>(std::numeric_limits<int64_t>::max()) &&
+ dd >=
+ static_cast<long double>(std::numeric_limits<int64_t>::lowest())) {
int64_t x = static_cast<int64_t>(dd);
EXPECT_EQ(x, StreamRoundTrip<int64_t>(x));
}