https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66405
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Here is a slightly longer testcase, that only ICEs with 5.1.1 and 6.0: trippels@gcc2-power8 view % cat zip.ii namespace std { template <typename _Tp> struct A { static constexpr _Tp value = 0; }; typedef A<bool> false_type; struct is_lvalue_reference : false_type {}; template <typename _Tp> _Tp declval(); template <typename> struct H : A<bool> {}; template <bool> struct enable_if { typedef int type; }; template <typename _Iftrue> struct conditional { typedef _Iftrue type; }; } namespace meta { template <typename T, T...> struct B; template <typename T> using eval = typename T::type; template <typename...> struct I : std::enable_if<1> {}; template <typename If, typename Then, typename Else> struct I<If, Then, Else> : std::conditional<Then> {}; template <typename... Args> using if_ = eval<I<Args...>>; template <bool, typename> using if_c = eval<I<>>; template <bool... Bools> using and_c = std::H<B<bool, Bools || true...>>; template <typename T, T...> struct B {}; template <long...> using index_sequence = B<long>; } namespace adl_begin_end_detail { struct begin_fn; } using adl_begin_end_detail::begin_fn; template <typename...> struct C; template <typename T> struct static_const { static constexpr T value{}; }; template <typename... Us> using Constructible = C<Us...>; template <typename> using SemiRegular = C<>; template <typename T> using function_type = decltype(std::declval<T>()); template <typename> using iterator_reference_t = int; namespace adl_begin_end_detail { struct begin_fn { template <typename Rng, meta::if_c<std::is_lvalue_reference::value, int> = 0> auto impl(Rng rng, int) -> decltype(rng.begin()); template <typename Rng> auto operator()(Rng rng) -> decltype(impl(rng, 0)); }; } auto begin = static_const<begin_fn>::value; struct range_access { template <typename Rng> static auto begin_cursor(Rng rng, int) -> decltype(rng.begin_cursor()); template <typename Cur> static auto current(Cur) -> decltype(0); }; template <typename Cur, typename> struct basic_iterator { using reference = decltype(range_access::current(std::declval<Cur>())); }; template <typename Derived> using begin_cursor_t = decltype(range_access::begin_cursor(std::declval<Derived>(), 0)); template <typename Derived> using end_cursor_t = decltype(std::declval<Derived>); template <typename Derived> using facade_iterator_t = basic_iterator<begin_cursor_t<Derived>, end_cursor_t<Derived>>; template <typename> struct iter_zip_with_view; struct indirect_zip_fn_; struct D { template <typename D = iter_zip_with_view<indirect_zip_fn_>> facade_iterator_t<D> begin(); }; template <typename> struct F; template <typename T> using semiregular_t = meta::if_<SemiRegular<T>, T, F<T>>; struct { template <typename Fun, typename Tup> auto impl(Fun fun, Tup, meta::index_sequence<>) -> decltype(fun()); template <typename Fun, typename Tup> auto operator()(Fun fun, Tup) -> decltype(impl(fun, 0, {})); } tuple_apply; template <typename... Ts> struct common_tuple { template <std::enable_if<meta::and_c<>::value>::type = 0> common_tuple(); template <typename... Us, typename std::enable_if<meta::and_c< (int)Constructible<Ts, Us>()...>::value>::type> common_tuple(); }; template <typename Fun> struct iter_zip_with_view : D { semiregular_t<function_type<Fun>> fun_; struct G { auto current() -> decltype(tuple_apply(fun_, 0)); }; G begin_cursor(); }; struct indirect_zip_fn_ { template <typename... Its> auto operator()() -> decltype(common_tuple<iterator_reference_t<Its>...>{}); }; struct zip_view : iter_zip_with_view<int> { } __trans_tmp_1; void check_equal() { auto rng = __trans_tmp_1; begin(rng); }