https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82514
Bug ID: 82514 Summary: [8 Regression] ICE: in operator[], at vec.h:749 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: trippels at gcc dot gnu.org CC: jason at gcc dot gnu.org Target Milestone: --- % cat minimal_product.ii template <typename _Iftrue> struct A { typedef _Iftrue type; }; template <int, typename _Iftrue, typename> using conditional_t = typename A<_Iftrue>::type; struct B; template <typename> struct ebo {}; template <bool> struct C; template <typename, typename = void> struct tag_of; template <typename> struct D; struct unpack_t { template <typename Xs, typename F> constexpr decltype(auto) operator()(Xs &&, F &&) const; } a; template <typename _Tp, _Tp...> struct F; template <typename _Tp, _Tp> using make_integer_sequence = F<_Tp>; template <long... _Idx> using index_sequence = F<unsigned long, _Idx...>; template <int> using make_index_sequence = make_integer_sequence<unsigned long, 0>; template <typename...> struct G; template <long... n, typename... Xn> struct G<index_sequence<n...>, Xn...> : ebo<Xn>... {}; template <typename... Xn> struct M : G<make_index_sequence<sizeof...(Xn)>, Xn...> {}; template <typename... Xn> struct tag_of<M<Xn...>> { using type = B; }; template <> struct D<B> { template <typename... Xn, typename F> static auto apply(G<index_sequence<>, Xn...> p1, F p2) { p2(static_cast<ebo<Xn>>(p1)...); } }; template <typename T, typename> struct tag_of : tag_of<T, C<0>> {}; template <typename T, bool condition> struct tag_of<T, C<condition>> { using type = typename T::hana_tag; }; template <typename T> struct tag_of<T &> : tag_of<T> {}; template <typename> struct H { template <typename X> constexpr decltype(auto) operator()(X &&) const; }; struct { H<int> to; } b; template <typename Xs, typename F> constexpr decltype(auto) unpack_t::operator()(Xs &&p1, F &&p2) const { using S = typename tag_of<Xs>::type; using Unpack = conditional_t<0, D<S>, int>; Unpack::apply(p1, p2); } template <typename... Xn> struct I { M<Xn...> storage_; using hana_tag = int; }; template <> struct D<int> { template <typename Xs, typename F> static auto apply(Xs p1, F p2) { a(p1.storage_, p2); } }; template <typename Algorithm> template <typename X> constexpr decltype(auto) H<Algorithm>::operator()(X &&) const {} template <typename T, typename = void> struct N : N<T, C<0>> {}; struct for_each_t { template <typename Xs, typename F> constexpr void operator()(Xs &&, F &&) const; } c; template <typename Xs, typename F> constexpr void for_each_t::operator()(Xs &&p1, F &&p2) const { using S = typename tag_of<Xs>::type; using ForEach = conditional_t<0, N<S>, int>; ForEach::apply(p1, p2); } template <typename F> struct J { F f; template <typename... Xs> void operator()(Xs... p1) { using Swallow = int; Swallow{((*f)(p1), 0)...}; } }; template <typename T, bool condition> struct N<T, C<condition>> { template <typename Xs, typename F> static void apply(Xs p1, F p2) { a(p1, J<decltype(&p2)>{}); } }; struct K { template <typename Foldables> K(Foldables p1) { c(p1, [](auto) { struct L {}; b.to(L{}); }); } }; I<int> d; int main() { K{d}; } % g++ -c minimal_product.ii minimal_product.ii: In instantiation of ‘constexpr decltype(auto) H< <template-parameter-1-1> >::operator()(X&&) const [with X = K::K(Foldables)::<lambda(auto:1)> [with auto:1 = ebo<int>; Foldables = I<int>]::L; <template-parameter-1-1> = int]’: minimal_product.ii:58:26: required from here minimal_product.ii:58:26: internal compiler error: in operator[], at vec.h:749 constexpr decltype(auto) H<Algorithm>::operator()(X &&) const {} ^~~~~~~~~~~~ 0x10362fa3 vec<tree_node*, va_gc, vl_embed>::operator[](unsigned int) ../../gcc/gcc/vec.h:749 0x10362fa3 local_class_index ../../gcc/gcc/cp/mangle.c:1894 0x1036d25b discriminator_for_local_entity ../../gcc/gcc/cp/mangle.c:1930 0x1036d25b write_local_name ../../gcc/gcc/cp/mangle.c:2031 0x1036d25b write_name ../../gcc/gcc/cp/mangle.c:964 0x10372fe3 write_encoding ../../gcc/gcc/cp/mangle.c:825 0x1036ce33 write_local_name ../../gcc/gcc/cp/mangle.c:2000 0x1036ce33 write_name ../../gcc/gcc/cp/mangle.c:964 0x1036defb write_class_enum_type ../../gcc/gcc/cp/mangle.c:2781 0x1036defb write_type ../../gcc/gcc/cp/mangle.c:2195 0x1036cb43 write_template_args ../../gcc/gcc/cp/mangle.c:2810 0x10374c83 write_nested_name ../../gcc/gcc/cp/mangle.c:1063 0x1036d047 write_name ../../gcc/gcc/cp/mangle.c:976 0x10372fe3 write_encoding ../../gcc/gcc/cp/mangle.c:825 0x10375893 mangle_decl_string ../../gcc/gcc/cp/mangle.c:3760 0x10375bfb get_mangled_id ../../gcc/gcc/cp/mangle.c:3782 0x10375bfb mangle_decl(tree_node*) ../../gcc/gcc/cp/mangle.c:3820 0x10f3024f decl_assembler_name(tree_node*) ../../gcc/gcc/tree.c:673 0x10f612eb assign_assembler_name_if_needed(tree_node*) ../../gcc/gcc/tree.c:5595 0x10690e1f cgraph_node::analyze() ../../gcc/gcc/cgraphunit.c:663