[Bug c++/71711] New: ICE on valid C++1z code with fold expression: tree check: expected tree_vec, have expr_pack_expansion in tsubst_unary_left_fold, at cp/pt.c:10792

su at cs dot ucdavis.edu gcc-bugzilla@gcc.gnu.org
Thu Jun 30 06:38:00 GMT 2016


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

            Bug ID: 71711
           Summary: ICE on valid C++1z code with fold expression: tree
                    check: expected tree_vec, have expr_pack_expansion in
                    tsubst_unary_left_fold, at cp/pt.c:10792
           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 following C++1z code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.  


$ 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 20160629 (experimental) [trunk revision 237855] (GCC) 
$ 
$ clang++-3.8 -c -std=c++1z small.cpp
$ 
$ g++-trunk -c -std=c++1z small.cpp
small.cpp: In substitution of ‘template<int ...N> void
foo(A<#‘unary_left_fold_expr’ not supported by dump_expr#<expression error> >)
[with int ...N = {1, 2, 3}]’:
small.cpp:6:22:   required from here
small.cpp:2:29: internal compiler error: tree check: expected tree_vec, have
expr_pack_expansion in tsubst_unary_left_fold, at cp/pt.c:10792
 template < int ... N > void foo (A < (... + N) >) {};
                             ^~~
0x105e86c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc-source-trunk/gcc/tree.c:9751
0x6e0aff tree_check
        ../../gcc-source-trunk/gcc/tree.h:3030
0x6e0aff tsubst_unary_left_fold
        ../../gcc-source-trunk/gcc/cp/pt.c:10792
0x6e0aff tsubst_copy
        ../../gcc-source-trunk/gcc/cp/pt.c:14537
0x6e2c76 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:17243
0x6d6c6f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/cp/pt.c:15868
0x6ecdac tsubst_template_arg
        ../../gcc-source-trunk/gcc/cp/pt.c:10436
0x6fc1b2 tsubst_template_args
        ../../gcc-source-trunk/gcc/cp/pt.c:11279
0x700fbb tsubst_aggr_type
        ../../gcc-source-trunk/gcc/cp/pt.c:11476
0x6ea2c7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:12953
0x6f8792 tsubst_arg_types
        ../../gcc-source-trunk/gcc/cp/pt.c:12559
0x6f8b8c tsubst_function_type
        ../../gcc-source-trunk/gcc/cp/pt.c:12694
0x6e9ff7 tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc-source-trunk/gcc/cp/pt.c:13416
0x713b5d 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:17795
0x6746cb add_template_candidate_real
        ../../gcc-source-trunk/gcc/cp/call.c:3110
0x6753fc add_template_candidate
        ../../gcc-source-trunk/gcc/cp/call.c:3188
0x6753fc add_candidates
        ../../gcc-source-trunk/gcc/cp/call.c:5361
0x6779f9 perform_overload_resolution
        ../../gcc-source-trunk/gcc/cp/call.c:4045
0x679eee build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
        ../../gcc-source-trunk/gcc/cp/call.c:4122
0x818030 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc-source-trunk/gcc/cp/semantics.c:2433
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 < int > struct A {};
template < int ... N > void foo (A < (... + N) >) {};

void bar ()  
{
  foo < 1, 2, 3 > ({});
}


More information about the Gcc-bugs mailing list