[libc++] Protect <span> against min/max macro

Patch by Corentin Jabot
Differential Revision: https://reviews.llvm.org/D73855

Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 1ac44d9fd1d994d41ddf26ed4991bfd6b5b17dca
diff --git a/include/span b/include/span
index 3421ca0..5d5a701 100644
--- a/include/span
+++ b/include/span
@@ -143,7 +143,7 @@
 
 #if _LIBCPP_STD_VER > 17
 
-inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
+inline constexpr size_t dynamic_extent = (numeric_limits<size_t>::max)();
 template <typename _Tp, size_t _Extent = dynamic_extent> class span;
 
 
diff --git a/test/libcxx/min_max_macros.sh.cpp b/test/libcxx/min_max_macros.sh.cpp
index 4310294..47c8a09 100644
--- a/test/libcxx/min_max_macros.sh.cpp
+++ b/test/libcxx/min_max_macros.sh.cpp
@@ -177,6 +177,8 @@
 #include <shared_mutex>
 TEST_MACROS();
 #endif
+#include <span>
+TEST_MACROS();
 #include <sstream>
 TEST_MACROS();
 #include <stack>