http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58836

            Bug ID: 58836
           Summary: ICE with wrong usage of initializer list in non-type
                    template argument
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid code snippet (compiled with "-std=c++11" or "-std=c++0x"
for older compilers) triggers an ICE since GCC 4.4.0 (when initializer lists
were introduced):

===============================================
template<typename, int> struct A;

template<typename T> struct A<T, T{}> {};

A<int, 0> a;
===============================================

bug.cc:5:11: internal compiler error: in unify, at cp/pt.c:17829
 A<int, 0> a;
           ^
0x5d22ef unify
        ../../gcc/gcc/cp/pt.c:17829
0x5d158b unify
        ../../gcc/gcc/cp/pt.c:17651
0x5d387e get_class_bindings
        ../../gcc/gcc/cp/pt.c:18378
0x5d44ea most_specialized_class
        ../../gcc/gcc/cp/pt.c:18623
0x5e52f0 instantiate_class_template_1
        ../../gcc/gcc/cp/pt.c:8704
0x5e52f0 instantiate_class_template(tree_node*)
        ../../gcc/gcc/cp/pt.c:9236
0x676d9b complete_type(tree_node*)
        ../../gcc/gcc/cp/typeck.c:132
0x5601b9 start_decl_1(tree_node*, bool)
        ../../gcc/gcc/cp/decl.c:4679
0x589ef1 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:4642
0x662d1a cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16514
0x6645ff cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11054
0x647f80 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10935
0x66f17e cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10832
0x66de9a cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10718
0x66f7b6 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3990
0x66f7b6 c_parse_file()
        ../../gcc/gcc/cp/parser.c:30970
0x78c623 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]

Reply via email to