[Bug c++/71833] New: ICE on valid C++11 code with nested variadic templates: tree check: accessed elt 0 of tree_vec with 1 elts in coerce_template_parameter_pack, at cp/pt.c:7439

su at cs dot ucdavis.edu gcc-bugzilla@gcc.gnu.org
Sun Jul 10 22:55:00 GMT 2016


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

            Bug ID: 71833
           Summary: ICE on valid C++11 code with nested variadic
                    templates: tree check: accessed elt 0 of tree_vec with
                    1 elts in coerce_template_parameter_pack, at
                    cp/pt.c:7439
           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++11 code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.  

It is a regression from 6.1.x, but which (and earlier versions of GCC)
incorrectly rejects the code. 


$ 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 20160710 (experimental) [trunk revision 238196] (GCC) 
$ 
$ clang++-3.8 -c -std=c++11 small.cpp
$ 
$ g++-6.1 -c -std=c++11 small.cpp
small.cpp:6:15: error: wrong number of template arguments (0, should be 1)
 A <>::B < int > e;
               ^
$ 
$ g++-trunk -c -std=c++11 small.cpp
small.cpp:6:15: internal compiler error: tree check: accessed elt 0 of tree_vec
with 1 elts in coerce_template_parameter_pack, at cp/pt.c:7439
 A <>::B < int > e;
               ^
0x10666c5 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
        ../../gcc-source-trunk/gcc/tree.c:9948
0x6fb4c0 tree_vec_elt_check
        ../../gcc-source-trunk/gcc/tree.h:3251
0x6fb4c0 coerce_template_parameter_pack
        ../../gcc-source-trunk/gcc/cp/pt.c:7439
0x6fb4c0 coerce_template_parms
        ../../gcc-source-trunk/gcc/cp/pt.c:7659
0x6fbf29 coerce_innermost_template_parms
        ../../gcc-source-trunk/gcc/cp/pt.c:7840
0x6fd7ea lookup_template_class_1
        ../../gcc-source-trunk/gcc/cp/pt.c:8331
0x6fd7ea lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc-source-trunk/gcc/cp/pt.c:8672
0x81769d finish_template_type(tree_node*, tree_node*, int)
        ../../gcc-source-trunk/gcc/cp/semantics.c:3133
0x7a3ce4 cp_parser_template_id
        ../../gcc-source-trunk/gcc/cp/parser.c:14919
0x7a3f8a cp_parser_class_name
        ../../gcc-source-trunk/gcc/cp/parser.c:21223
0x7929ad cp_parser_qualifying_entity
        ../../gcc-source-trunk/gcc/cp/parser.c:6250
0x7929ad cp_parser_nested_name_specifier_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:5934
0x7a4707 cp_parser_constructor_declarator_p
        ../../gcc-source-trunk/gcc/cp/parser.c:25148
0x7a4707 cp_parser_decl_specifier_seq
        ../../gcc-source-trunk/gcc/cp/parser.c:12748
0x7adc91 cp_parser_simple_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12304
0x7ae0e1 cp_parser_block_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12251
0x7b6d50 cp_parser_declaration
        ../../gcc-source-trunk/gcc/cp/parser.c:12148
0x7b5824 cp_parser_declaration_seq_opt
        ../../gcc-source-trunk/gcc/cp/parser.c:12027
0x7b5b58 cp_parser_translation_unit
        ../../gcc-source-trunk/gcc/cp/parser.c:4329
0x7b5b58 c_parse_file()
        ../../gcc-source-trunk/gcc/cp/parser.c:37505
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 ... Ts > struct A 
{
  template < Ts ..., typename ... Us > struct B {};
};

A <>::B < int > e;


More information about the Gcc-bugs mailing list