[PATCH] D146340: [ADT] Work around `enumerate` compilation error with modules enabled
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 20 11:35:57 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92416b63a57b: [ADT] Work around `enumerate` compilation error with modules enabled (authored by kuhar).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146340/new/
https://reviews.llvm.org/D146340
Files:
llvm/include/llvm/ADT/STLExtras.h
Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -2385,10 +2385,16 @@
///
template <typename FirstRange, typename... RestRanges>
auto enumerate(FirstRange &&First, RestRanges &&...Rest) {
- assert((sizeof...(Rest) == 0 ||
- all_equal({std::distance(adl_begin(First), adl_end(First)),
- std::distance(adl_begin(Rest), adl_end(Rest))...})) &&
- "Ranges have different length");
+ if constexpr (sizeof...(Rest) != 0) {
+#ifndef NDEBUG
+ // Note: Create an array instead of an initializer list to work around an
+ // Apple clang 14 compiler bug.
+ size_t sizes[] = {
+ static_cast<size_t>(std::distance(adl_begin(First), adl_end(First))),
+ static_cast<size_t>(std::distance(adl_begin(Rest), adl_end(Rest)))...};
+ assert(all_equal(sizes) && "Ranges have different length");
+#endif
+ }
using enumerator = detail::zippy<detail::zip_enumerator, detail::index_stream,
FirstRange, RestRanges...>;
return enumerator(detail::index_stream{}, std::forward<FirstRange>(First),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146340.506667.patch
Type: text/x-patch
Size: 1215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230320/6101f3b1/attachment.bin>
More information about the llvm-commits
mailing list