[libcxx-commits] [PATCH] D73855: Protect <span> against mim/max macro

Corentin Jabot via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 2 13:25:21 PST 2020


cor3ntin created this revision.
cor3ntin added a reviewer: ldionne.
Herald added subscribers: libcxx-commits, dexonsmith, christof.
Herald added a project: libc++.

While working on something else, I noticed <span> doesn't protect itself against `max` which was failing one of my tests
Now it does


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73855

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


Index: libcxx/test/libcxx/min_max_macros.sh.cpp
===================================================================
--- libcxx/test/libcxx/min_max_macros.sh.cpp
+++ libcxx/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>
Index: libcxx/include/span
===================================================================
--- libcxx/include/span
+++ libcxx/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;
 
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73855.241945.patch
Type: text/x-patch
Size: 777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200202/f0d78ac7/attachment.bin>


More information about the libcxx-commits mailing list