https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107177
Bug ID: 107177 Summary: ICE: tree check: expected type_argument_pack or nontype_argument_pack, have integer_type in unify_pack_expansion, at cp/pt.cc:23912 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- g++ 13.0.0 20220925 snapshot (g:77bbf69d2981dafc2ef3e59bfbefb645d88bab9d) ICEs when compiling the following testcase, reduced from test/SemaTemplate/pack-deduction.cpp from the clang 15.0.1 test suite: template<typename ...T> struct X {}; template<typename ...T> int f1(X<T, T...>... a); int a1 = f1(X<int, int, double>(), X<double, int, double>()); % g++-13.0.0 -c r6lgqt43.cpp r6lgqt43.cpp: In substitution of 'template<class ... T> int f1(X<T, T ...>...) [with T = <missing>]': r6lgqt43.cpp:6:14: required from here r6lgqt43.cpp:6:14: internal compiler error: tree check: expected type_argument_pack or nontype_argument_pack, have integer_type in unify_pack_expansion, at cp/pt.cc:23912 6 | int a1 = f1(X<int, int, double>(), X<double, int, double>()); | ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0x89062a tree_check_failed(tree_node const*, char const*, int, char const*, ...) /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/tree.cc:8827 0x71cbda tree_check2(tree_node*, char const*, int, char const*, tree_code, tree_code) /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/tree.h:3539 0x71cbda unify_pack_expansion /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:23912 0xb60eb5 unify /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:24728 0xb60ce5 unify /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:24925 0xb60e73 unify /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:24722 0xb605b9 try_class_unification /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:23679 0xb61253 unify /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:24759 0xb5e1bc unify_one_argument /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:22894 0xb5eefa unify_pack_expansion /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:23943 0xb73e50 type_unification_real /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:23037 0xb8a74a fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/pt.cc:22341 0x9722cf add_template_candidate_real /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:3573 0x97339a add_template_candidate /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:3661 0x97339a add_candidates /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:6219 0x979969 add_candidates /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:4726 0x979969 perform_overload_resolution /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:4743 0x97f1f2 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/call.cc:4850 0xbac94a finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/semantics.cc:2904 0xb051fb cp_parser_postfix_expression /var/tmp/portage/sys-devel/gcc-13.0.0_p20220925/work/gcc-13-20220925/gcc/cp/parser.cc:7965 Previous gcc releases ICE (down to at leaset 4.7) in tsubst, at cp/pt.cc:15867. clang accepts this snippet.