[libcxx-commits] [libcxx] 1ac44d9 - [libc++] Protect <span> against min/max macro

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 10 04:41:45 PST 2020


Author: Louis Dionne
Date: 2020-02-10T13:41:34+01:00
New Revision: 1ac44d9fd1d994d41ddf26ed4991bfd6b5b17dca

URL: https://github.com/llvm/llvm-project/commit/1ac44d9fd1d994d41ddf26ed4991bfd6b5b17dca
DIFF: https://github.com/llvm/llvm-project/commit/1ac44d9fd1d994d41ddf26ed4991bfd6b5b17dca.diff

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

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

Added: 
    

Modified: 
    libcxx/include/span
    libcxx/test/libcxx/min_max_macros.sh.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/span b/libcxx/include/span
index 3421ca0f5a8e..5d5a701f7548 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -143,7 +143,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
 
 #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/libcxx/test/libcxx/min_max_macros.sh.cpp b/libcxx/test/libcxx/min_max_macros.sh.cpp
index 4310294ca022..47c8a09e991b 100644
--- a/libcxx/test/libcxx/min_max_macros.sh.cpp
+++ b/libcxx/test/libcxx/min_max_macros.sh.cpp
@@ -177,6 +177,8 @@ TEST_MACROS();
 #include <shared_mutex>
 TEST_MACROS();
 #endif
+#include <span>
+TEST_MACROS();
 #include <sstream>
 TEST_MACROS();
 #include <stack>


        


More information about the libcxx-commits mailing list