https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77554

            Bug ID: 77554
           Summary: ICE on valid C++11 code with variadic template
                    function: tree check: expected class ‘expression’,
                    have ‘type’ (integer_type) in tree_operand_check, at
                    tree.h:3524
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The code is accepted by both Clang and MSVC. 

It crashes all versions 4.8.x and later, and seems to be a regression from
4.7.x. However, 4.8.x to 6.2.x have a different crash log from the trunk. 


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160910 (experimental) [trunk revision 240069] (GCC) 
$ 
$ clang++-3.8 -c -std=c++11 small.cpp
$ 
$ g++-trunk -c small.cpp
small.cpp: In substitution of ‘template<class ... T> int f(X<T, T ...>...)
[with T = <missing>]’:
small.cpp:3:29:   required from here
small.cpp:3:29: internal compiler error: tree check: expected class
‘expression’, have ‘type’ (integer_type) in tree_operand_check, at tree.h:3524
 int a = f (X < int, int > ());
                             ^
0x1087d57 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-source-trunk/gcc/tree.c:9793
0x5df6b1 expr_check
        ../../gcc-source-trunk/gcc/tree.h:3195
0x5df6b1 tree_operand_check
        ../../gcc-source-trunk/gcc/tree.h:3524
0x70e0df tree_operand_check
        ../../gcc-source-trunk/gcc/tree.h:3140
0x70e0df unify_pack_expansion
        ../../gcc-source-trunk/gcc/cp/pt.c:19291
0x711578 unify
        ../../gcc-source-trunk/gcc/cp/pt.c:20089
0x7102ea unify
        ../../gcc-source-trunk/gcc/cp/pt.c:19985
0x710e46 unify
        ../../gcc-source-trunk/gcc/cp/pt.c:20081
0x5dfbd6 try_class_unification
        ../../gcc-source-trunk/gcc/cp/pt.c:19085
0x7100bf unify
        ../../gcc-source-trunk/gcc/cp/pt.c:20119
0x70c55d unify_one_argument
        ../../gcc-source-trunk/gcc/cp/pt.c:18412
0x70d674 unify_pack_expansion
        ../../gcc-source-trunk/gcc/cp/pt.c:19323
0x70f0d9 type_unification_real
        ../../gcc-source-trunk/gcc/cp/pt.c:18506
0x71cd24 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:17931
0x67af4b add_template_candidate_real
        ../../gcc-source-trunk/gcc/cp/call.c:3119
0x67bc7c add_template_candidate
        ../../gcc-source-trunk/gcc/cp/call.c:3197
0x67bc7c add_candidates
        ../../gcc-source-trunk/gcc/cp/call.c:5396
0x67e3e9 perform_overload_resolution
        ../../gcc-source-trunk/gcc/cp/call.c:4066
0x6808de build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../gcc-source-trunk/gcc/cp/call.c:4143
0x8241f0 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc-source-trunk/gcc/cp/semantics.c:2440
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.
$ 


---------------------------------------------------------


template < typename ... > struct X {};
template < typename ... T > int f (X < T, T ... > ...);
int a = f (X < int, int > ());

Reply via email to