https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86426
Bug ID: 86426 Summary: g++ ICE at on valid code in tree_operand_check, at tree.h:3615 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: helloqirun at gmail dot com Target Milestone: --- It affects versions from 4.8 to trunk. g++4.6 emits errors. But clang++ can compile. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 9.0.0 20180706 (experimental) [trunk revision 262476] (GCC) $ g++-trunk abc.c abc.c: In substitution of ‘template<class ... T> int {anonymous}::f1(X<T, T ...>...) [with T = <missing>]’: abc.c:4:26: required from here abc.c:4:26: internal compiler error: tree check: expected class ‘expression’, have ‘type’ (integer_type) in tree_operand_check, at tree.h:3615 int a1 = f1(X<int, int>()); ^ 0x78c90b tree_class_check_failed(tree_node const*, tree_code_class, char const*, int, char const*) ../../gcc/gcc/tree.c:9403 0x651e95 expr_check(tree_node*, char const*, int, char const*) ../../gcc/gcc/tree.h:3286 0x651e95 tree_operand_check(tree_node*, int, char const*, int, char const*) ../../gcc/gcc/tree.h:3615 0x651e95 unify_pack_expansion ../../gcc/gcc/cp/pt.c:21125 0x97665d unify ../../gcc/gcc/cp/pt.c:21919 0x9758b3 unify ../../gcc/gcc/cp/pt.c:22116 0x976612 unify ../../gcc/gcc/cp/pt.c:21913 0x974e92 try_class_unification ../../gcc/gcc/cp/pt.c:20907 0x9766b5 unify ../../gcc/gcc/cp/pt.c:21950 0x97bb93 unify_one_argument ../../gcc/gcc/cp/pt.c:20161 0x97c914 unify_pack_expansion ../../gcc/gcc/cp/pt.c:21156 0x97dce3 type_unification_real ../../gcc/gcc/cp/pt.c:20300 0x97ee7f fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool) ../../gcc/gcc/cp/pt.c:19660 0x826a02 add_template_candidate_real ../../gcc/gcc/cp/call.c:3212 0x827414 add_template_candidate ../../gcc/gcc/cp/call.c:3291 0x827414 add_candidates ../../gcc/gcc/cp/call.c:5532 0x827801 add_candidates ../../gcc/gcc/cp/call.c:4225 0x827801 perform_overload_resolution ../../gcc/gcc/cp/call.c:4233 0x829722 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/gcc/cp/call.c:4306 0x9a0dad finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/gcc/cp/semantics.c:2536 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. $ cat abc.c template <typename...> struct X {}; namespace { template <typename... T> int f1(X<T, T...>...); int a1 = f1(X<int, int>()); }