https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67411
Bug ID: 67411 Summary: [5/6 Regression] internal compiler error: in tsubst_copy, at cp/pt.c:13473 Product: gcc Version: 5.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- #include <tuple> template<typename functor_type> void invoke_lambda(functor_type &&functor) { functor(); } template<typename functor_type, typename arg_type> void invoke_lambda(arg_type &&arg, functor_type &&functor) { functor(std::forward<arg_type>(arg)); } class conn; class ts { public: int timestamp; }; void bar(conn *c, int timestamp) { } void foo(conn *c, ts *t) { invoke_lambda([tuple_conn=std::make_tuple(c), timestamp=t->timestamp] { invoke_lambda(tuple_conn, [&] (const auto &tuple_conn) { invoke_lambda([=] { bar(std::get<0>(tuple_conn), timestamp); }); }); }); } With 5/trunk I get: t.C: In instantiation of ‘foo(conn*, ts*)::<lambda()>::<lambda(const auto:1&)>::<lambda()> [with auto:1 = std::tuple<conn*>]’: t.C:30:43: required from ‘struct foo(conn*, ts*)::<lambda()>::<lambda(const auto:1&)> [with auto:1 = std::tuple<conn*>]::<lambda()>’ t.C:30:20: required from ‘foo(conn*, ts*)::<lambda()>::<lambda(const auto:1&)> [with auto:1 = std::tuple<conn*>]’ t.C:12:10: required from ‘void invoke_lambda(arg_type&&, functor_type&&) [with functor_type = foo(conn*, ts*)::<lambda()>::<lambda(const auto:1&)>; arg_type = const std::tuple<conn*>&]’ t.C:30:73: required from here t.C:28:73: internal compiler error: in tsubst_copy, at cp/pt.c:13473 invoke_lambda([tuple_conn=std::make_tuple(c), timestamp=t->timestamp] { ^ 0x6480d4 tsubst_copy /home/marek/src/gcc/gcc/cp/pt.c:13473 0x649542 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:16225 0x64afd3 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:15250 0x64a294 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:16006 0x63c490 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marek/src/gcc/gcc/cp/pt.c:15031 0x643ab9 tsubst_decl /home/marek/src/gcc/gcc/cp/pt.c:11958 0x6472ce tsubst_copy /home/marek/src/gcc/gcc/cp/pt.c:13604 0x649542 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:16225 0x64b1d7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:15715 0x63c490 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marek/src/gcc/gcc/cp/pt.c:15031 0x63ce72 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marek/src/gcc/gcc/cp/pt.c:14442 0x63bc6b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marek/src/gcc/gcc/cp/pt.c:14614 0x63b993 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marek/src/gcc/gcc/cp/pt.c:14428 0x63bc6b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marek/src/gcc/gcc/cp/pt.c:14614 0x639f45 instantiate_decl(tree_node*, int, bool) /home/marek/src/gcc/gcc/cp/pt.c:21158 0x67b188 instantiate_class_template_1 /home/marek/src/gcc/gcc/cp/pt.c:10161 0x67b188 instantiate_class_template(tree_node*) /home/marek/src/gcc/gcc/cp/pt.c:10229 0x71aebb complete_type(tree_node*) /home/marek/src/gcc/gcc/cp/typeck.c:138 0x64aa0d tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:16345 0x64b1d7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marek/src/gcc/gcc/cp/pt.c:15715 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.