[llvm] 497953b - [ADT] Remove SFINAE constraint from llvm::iterator_range ctor for gcc-7
Balazs Benics via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 18 00:15:40 PDT 2023
Author: Balazs Benics
Date: 2023-07-18T09:15:11+02:00
New Revision: 497953b498ca6bb18bd67dc6e63f6e32ce36b2e0
URL: https://github.com/llvm/llvm-project/commit/497953b498ca6bb18bd67dc6e63f6e32ce36b2e0
DIFF: https://github.com/llvm/llvm-project/commit/497953b498ca6bb18bd67dc6e63f6e32ce36b2e0.diff
LOG: [ADT] Remove SFINAE constraint from llvm::iterator_range ctor for gcc-7
It turns out the SFINAE constraint breaks building MLIR using GCC-7,
which is an outdated, but supported compiler by llvm-project.
I tried to find a solution for fixing it, but I decided to cut branches
and just simply remove the SFINAE constraint until we drop GCC-7.
It was originally introduced by D152891.
Allegedly, GCC-8 and above builds just fine.
I tested GCC 8.4.0, and GCC 7.5.0, and now builds fine on both.
Differential Revision: https://reviews.llvm.org/D155441
Fixes https://github.com/llvm/llvm-project/issues/63843
Added:
Modified:
llvm/include/llvm/ADT/iterator_range.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/iterator_range.h b/llvm/include/llvm/ADT/iterator_range.h
index 05379c114f7ca2..8c37455dc219fc 100644
--- a/llvm/include/llvm/ADT/iterator_range.h
+++ b/llvm/include/llvm/ADT/iterator_range.h
@@ -43,12 +43,19 @@ class iterator_range {
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)) {}
More information about the llvm-commits
mailing list