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

            Bug ID: 60383
           Summary: [4.8 Regression] ICE with invalid template
                    specialization
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following invalid testcase triggers an ICE on trunk:

==============================================
template<int> struct A
{
  template<typename> struct B
  {
    template<typename T> struct B<T*> {};
  };
};

A<0>::B<char*> b;
==============================================

bug.cc:5:33: error: specialization of 'template<int <anonymous> >
template<class> struct A<<anonymous> >::B' must appear at namespace scope
     template<typename T> struct B<T*> {};
                                 ^
bug.cc:5:33: internal compiler error: in retrieve_specialization, at
cp/pt.c:1039
0x6067b0 retrieve_specialization
        ../../gcc/gcc/cp/pt.c:1036
0x62ff67 tsubst_decl
        ../../gcc/gcc/cp/pt.c:10351
0x61ecdf tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:11489
0x63f2f1 most_specialized_class
        ../../gcc/gcc/cp/pt.c:18832
0x64ecf9 instantiate_class_template_1
        ../../gcc/gcc/cp/pt.c:8867
0x64ecf9 instantiate_class_template(tree_node*)
        ../../gcc/gcc/cp/pt.c:9399
0x6e1d83 complete_type(tree_node*)
        ../../gcc/gcc/cp/typeck.c:134
0x5c8e58 start_decl_1(tree_node*, bool)
        ../../gcc/gcc/cp/decl.c:4719
0x5f1ef7 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/gcc/cp/decl.c:4682
0x6ce2be cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16684
0x6cfd49 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:11205
0x6b3003 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:11086
0x6da2d2 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10983
0x6d8fc8 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10869
0x6da87a cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4014
0x6da87a c_parse_file()
        ../../gcc/gcc/cp/parser.c:31590
0x7fa103 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1060
Please submit a full bug report, [etc.]

Reply via email to