Skip to content

Commit 2f99d6b

Browse files
steakhaljdoerfert
authored andcommitted
[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 llvm#63843
1 parent b4a394e commit 2f99d6b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

llvm/include/llvm/ADT/iterator_range.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ class iterator_range {
4343
IteratorT begin_iterator, end_iterator;
4444

4545
public:
46+
#if __GNUC__ == 7
47+
// Be careful no to break gcc-7 on the mlir target.
48+
// See https://github.com/llvm/llvm-project/issues/63843
49+
template <typename Container>
50+
#else
4651
template <typename Container,
4752
std::enable_if_t<explicitly_convertible<
4853
detail::IterOfRange<Container>, IteratorT>::value> * = nullptr>
54+
#endif
4955
iterator_range(Container &&c)
5056
: begin_iterator(adl_begin(std::forward<Container>(c))),
51-
end_iterator(adl_end(std::forward<Container>(c))) {}
57+
end_iterator(adl_end(std::forward<Container>(c))) {
58+
}
5259
iterator_range(IteratorT begin_iterator, IteratorT end_iterator)
5360
: begin_iterator(std::move(begin_iterator)),
5461
end_iterator(std::move(end_iterator)) {}

0 commit comments

Comments
 (0)