[flang] Fix compilation error on macOS
authorTim Keith <tkeith@nvidia.com>
Mon, 10 Feb 2020 18:55:24 +0000 (10:55 -0800)
committerTim Keith <tkeith@nvidia.com>
Mon, 10 Feb 2020 18:55:24 +0000 (10:55 -0800)
The call to `std::min` failed to compile with GCC on macOS due to type
inference because `std::size_t` is `long unsigned int` but `std::int64_t`
is `long long int`.

Original-commit: flang-compiler/f18@c342575a9e0217fa3252b70b8ef3eac0236a58e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/977

flang/runtime/buffer.h

index ec39bac..57c740f 100644 (file)
@@ -41,8 +41,7 @@ public:
   FileOffset FrameAt() const { return fileOffset_ + frame_; }
   char *Frame() const { return buffer_ + start_ + frame_; }
   std::size_t FrameLength() const {
-    return std::min(
-        static_cast<std::size_t>(length_ - frame_), size_ - (start_ + frame_));
+    return std::min<std::size_t>(length_ - frame_, size_ - (start_ + frame_));
   }
 
   // Returns a short frame at a non-fatal EOF.  Can return a long frame as well.