diff options
author | Zachary Turner <zturner@google.com> | 2017-03-08 01:57:40 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-08 01:57:40 +0000 |
commit | 5dd24f5a2e726d47c0875205c5133a6c3e351c0d (patch) | |
tree | 4bcd8a5596cf28afe6c2f468072de60558e7a5f3 | |
parent | 4a4d245b194d56b74bbb9012d25b44aaba753e36 (diff) | |
download | bcm5719-llvm-5dd24f5a2e726d47c0875205c5133a6c3e351c0d.tar.gz bcm5719-llvm-5dd24f5a2e726d47c0875205c5133a6c3e351c0d.zip |
Work around an ICE on MSVC 2017.
MSVC 2017 was released today, and I found one bug in the
compiler which prevents a successful build of LLVM. This
patch works around the bug in a fairly benign way.
llvm-svn: 297255
-rw-r--r-- | llvm/include/llvm/ADT/STLExtras.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index d4cbc587e55..0389e3da4b1 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -358,21 +358,27 @@ template <class... Ts> struct index_sequence_for; namespace detail { using std::declval; +// We have to alias this since inlining the actual type at the usage site +// in the parameter list of iterator_facade_base<> below ICEs MSVC 2017. +template<typename... Iters> struct ZipTupleType { + typedef std::tuple<decltype(*declval<Iters>())...> type; +}; + template <typename ZipType, typename... Iters> using zip_traits = iterator_facade_base< ZipType, typename std::common_type<std::bidirectional_iterator_tag, typename std::iterator_traits< Iters>::iterator_category...>::type, // ^ TODO: Implement random access methods. - std::tuple<decltype(*declval<Iters>())...>, + typename ZipTupleType<Iters...>::type, typename std::iterator_traits<typename std::tuple_element< 0, std::tuple<Iters...>>::type>::difference_type, // ^ FIXME: This follows boost::make_zip_iterator's assumption that all // inner iterators have the same difference_type. It would fail if, for // instance, the second field's difference_type were non-numeric while the // first is. - std::tuple<decltype(*declval<Iters>())...> *, - std::tuple<decltype(*declval<Iters>())...>>; + typename ZipTupleType<Iters...>::type *, + typename ZipTupleType<Iters...>::type>; template <typename ZipType, typename... Iters> struct zip_common : public zip_traits<ZipType, Iters...> { |