https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86478
Bug ID: 86478 Summary: Crashed on legal code Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: zhonghao at pku dot org.cn Target Milestone: --- The code is as follows: template<class ...T> struct X {}; template<class ...T> void foo(X<T, T...>... a); void test() { foo(X<int, int, double>(), X<double, int, double>()); } g++ crashes when compiling the code: code0.cpp: In substitution of 'template<class ... T> void foo(X<T, T ...>...) [with T = <missing>]': code0.cpp:10:53: required from here code0.cpp:10:53: internal compiler error: tree check: expected class 'expression', have 'type' (integer_type) in tree_operand_check, at tree.h:3633 foo(X<int, int, double>(), X<double, int, double>()); ^ 0x79b1a2 tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../code/gcc/tree.c:9377 0x65b01a expr_check(tree_node*, char const*, int, char const*) ../../code/gcc/tree.h:3304 0x65b01a tree_operand_check(tree_node*, int, char const*, int, char const*) ../../code/gcc/tree.h:3633 0x65b01a unify_pack_expansion ../../code/gcc/cp/pt.c:20777 0x990032 unify ../../code/gcc/cp/pt.c:21565 0x98edf3 unify ../../code/gcc/cp/pt.c:21762 0x98fe10 unify ../../code/gcc/cp/pt.c:21559 0x98e8a2 try_class_unification ../../code/gcc/cp/pt.c:20559 0x990925 unify ../../code/gcc/cp/pt.c:21596 0x9958a3 unify_one_argument ../../code/gcc/cp/pt.c:19793 0x996520 unify_pack_expansion ../../code/gcc/cp/pt.c:20808 0x997ab6 type_unification_real ../../code/gcc/cp/pt.c:19933 0x998ab5 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool) ../../code/gcc/cp/pt.c:19298 0x839f0f add_template_candidate_real ../../code/gcc/cp/call.c:3179 0x83a920 add_template_candidate ../../code/gcc/cp/call.c:3258 0x83a920 add_candidates ../../code/gcc/cp/call.c:5520 0x83ad31 add_candidates ../../code/gcc/cp/call.c:4192 0x83ad31 perform_overload_resolution ../../code/gcc/cp/call.c:4200 0x83cda2 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../code/gcc/cp/call.c:4273 0x9bb475 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../code/gcc/cp/semantics.c:2534 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Clang++ accepts the above code.