[PATCH] D99340: [flang] Fix error compiling std::min on macos
Tim Keith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 25 07:29:12 PDT 2021
tskeith created this revision.
tskeith added a reviewer: klausler.
tskeith added a project: Flang.
Herald added a subscriber: jdoerfert.
tskeith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
On macos, `size_t` is `unsigned long` while `size_t - int64_t` is
`unsigned long long` so std::min requires an explicit type to compile.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99340
Files:
flang/unittests/Runtime/buffer.cpp
Index: flang/unittests/Runtime/buffer.cpp
===================================================================
--- flang/unittests/Runtime/buffer.cpp
+++ flang/unittests/Runtime/buffer.cpp
@@ -31,7 +31,7 @@
static_cast<int>(at), static_cast<int>(minBytes),
static_cast<int>(maxBytes));
}
- auto result{std::min(maxBytes, bytes_ - at)};
+ auto result{std::min<std::size_t>(maxBytes, bytes_ - at)};
std::memcpy(to, &data_[at], result);
expect_ = at + result;
return result;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99340.333300.patch
Type: text/x-patch
Size: 519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210325/bb7f1942/attachment.bin>
More information about the llvm-commits
mailing list