http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60033
Adam Butcher <abutcher at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abutcher at gcc dot gnu.org --- Comment #3 from Adam Butcher <abutcher at gcc dot gnu.org> --- The following reduced test case gives the same ICE: --------------------------- #include <utility> template <typename Func> auto compose(Func&& f) { return f; } template <typename Func, typename... Funcs> auto compose(Func&& f, Funcs&&... fs) { return [&] (auto v) { return f(compose(std::forward<Funcs>(fs)...)(v)); }; } int main() { float v = 3.5f; auto func = [] (auto v) { return int(v-0.5); }; auto t = compose([] (auto v) { return v >= 3; }, func)(v); auto f = compose([] (auto v) { return v > 3; }, func)(v); return (t == true && f == false)? 0 : 1; } --------------------------- 'retrieve_specialization' is failing an assertion due to a mismatch between the template argument depth and template decl depth when considering the pack expansion of the captured 'fs' within the generic lambda: --------------------------- || args => <tree_vec 0x7ffd49d54ed8 || elt 0 <tree_vec 0x7ffd49d54eb0 || elt 0 <record_type 0x7ffd49d48c78 __lambda2 needs-constructing type_5 type_6 QI || size <integer_cst 0x7ffd49df1280 constant 8> || unit size <integer_cst 0x7ffd49df12a0 constant 1> || align 8 symtab 0 alias set -1 canonical type 0x7ffd49d48c78 fields <type_decl 0x7ffd49d41b80 __lambda2> context <function_decl 0x7ffd49d2bc00 main> || full-name "struct main()::<lambda(auto:3)>" || needs-constructor X() has-type-conversion X(constX&) this=(X&) n_parents=0 use_template=0 interface-unknown || pointer_to_this <pointer_type 0x7ffd49d4b9d8> reference_to_this <reference_type 0x7ffd49d510a8> chain <type_decl 0x7ffd49d41ac8 __lambda2>> || elt 1 <type_argument_pack 0x7ffd49d56a80 || type <tree_vec 0x7ffd49d53a20 elt 0 <reference_type 0x7ffd49d48930>> || VOID || align 8 symtab 0 alias set -1 canonical type 0x7ffd49d56a80>> || elt 1 <tree_vec 0x7ffd49d53a40 || elt 0 <real_type 0x7ffd49e02348 float type_6 SF || size <integer_cst 0x7ffd49df1440 constant 32> || unit size <integer_cst 0x7ffd49df1460 constant 4> || align 32 symtab 0 alias set -1 canonical type 0x7ffd49e02348 precision 32 || pointer_to_this <pointer_type 0x7ffd49e02540>>>> || tmpl => <field_decl 0x7ffd49d34ab0 __fs || type <type_pack_expansion 0x7ffd49d450a8 || type <reference_type 0x7ffd49d45000 type <decltype_type 0x7ffd49d40f18> || unsigned DI || size <integer_cst 0x7ffd49df10c0 constant 64> || unit size <integer_cst 0x7ffd49df10e0 constant 8> || align 64 symtab 0 alias set -1 structural equality> || tree_0 VOID || align 8 symtab 0 alias set -1 structural equality> || used decl_7 VOID file gcc/testsuite/g++.dg/cpp1y/pr60033.C line 15 col 42 || align 1 offset_align 1 context <record_type 0x7ffd49d40000 __lambda0> chain <type_decl 0x7ffd49d410b8 __lambda0>> || TMPL_ARGS_DEPTH (args) => 2 || TREE_CODE (tmpl) == TEMPLATE_DECL => 0 || template_class_depth (DECL_CONTEXT (tmpl)) => 1 ---------------------------