[PATCH] D155441: [ADT] Remove SFINAE constraint from llvm::iterator_range ctor

Balázs Benics via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 12:17:51 PDT 2023


steakhal updated this revision to Diff 541180.
steakhal added a comment.

Guard the SFINAE by `#if` as suggested in https://github.com/llvm/llvm-project/issues/63843#issuecomment-1638162336

FYI the end curly is now suddenly clang-formatted to a new line, IDK why.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155441/new/

https://reviews.llvm.org/D155441

Files:
  llvm/include/llvm/ADT/iterator_range.h


Index: llvm/include/llvm/ADT/iterator_range.h
===================================================================
--- llvm/include/llvm/ADT/iterator_range.h
+++ llvm/include/llvm/ADT/iterator_range.h
@@ -43,12 +43,19 @@
   IteratorT begin_iterator, end_iterator;
 
 public:
+#if __GNUC__ == 7
+  // Be careful no to break gcc-7 on the mlir target.
+  // See https://github.com/llvm/llvm-project/issues/63843
+  template <typename Container>
+#else
   template <typename Container,
             std::enable_if_t<explicitly_convertible<
                 detail::IterOfRange<Container>, IteratorT>::value> * = nullptr>
+#endif
   iterator_range(Container &&c)
       : begin_iterator(adl_begin(std::forward<Container>(c))),
-        end_iterator(adl_end(std::forward<Container>(c))) {}
+        end_iterator(adl_end(std::forward<Container>(c))) {
+  }
   iterator_range(IteratorT begin_iterator, IteratorT end_iterator)
       : begin_iterator(std::move(begin_iterator)),
         end_iterator(std::move(end_iterator)) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155441.541180.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230717/a4c84f5f/attachment.bin>


More information about the llvm-commits mailing list