Fix C++20 build.

std::string::max_size() is constexpr in C++20, which lets the compiler
determine that a comparison can never succeed.  Cast to prevent a
resulting warning.

Bug: 1284275
Change-Id: Ib56f3a9a114b9f3d2210df7846869f9452a60a58
Reviewed-by: Satoru Takabayashi <>
Commit-Queue: Satoru Takabayashi <>
Auto-Submit: Peter Kasting <>
Cr-Commit-Position: refs/heads/main@{#1004522}
GitOrigin-RevId: 997528f9568938b61c551ff62315ecc0d1385b05
diff --git a/google/ b/google/
index c7f7888..0c4cf08 100644
--- a/google/
+++ b/google/
@@ -77,7 +77,7 @@
 bool GzipUncompress(const std::string& input, std::string* output) {
   std::string uncompressed_output;
   uLongf uncompressed_size = static_cast<uLongf>(GetUncompressedSize(input));
-  if (uncompressed_size > uncompressed_output.max_size())
+  if (size_t{uncompressed_size} > uncompressed_output.max_size())
     return false;