Fix clamp() ambiguity for C++17 builds. Although PDFium's GN-based build system uses C++14, other build systems may build PDFium in C++17 mode. In that situation, calling clamp() without a namespace will result in a compiler error due to ambiguities between pdfium::clamp() and std::clamp(). Bug: chromium:1231569 Change-Id: I643e8fa20fdb40a85e191b79d961e9239190ec63 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83794 Commit-Queue: Tom Sepez <tsepez@chromium.org> Auto-Submit: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/third_party/base/cxx17_backports.h b/third_party/base/cxx17_backports.h index 0bc781b..9d6a966 100644 --- a/third_party/base/cxx17_backports.h +++ b/third_party/base/cxx17_backports.h
@@ -38,7 +38,7 @@ template <typename T> constexpr const T& clamp(const T& v, const T& lo, const T& hi) { - return clamp(v, lo, hi, std::less<T>{}); + return pdfium::clamp(v, lo, hi, std::less<T>{}); } } // namespace pdfium