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

            Bug ID: 84537
           Summary: [8 Regression] ICE in get_string, at spellcheck-tree.h
           Product: gcc
           Version: 8.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
  Target Milestone: ---

The following invalid code snippet triggers an ICE on trunk:

=================================
namespace N
{
  template<int> struct A {};
}

N::template A<> a;
=================================

bug.cc:6:15: error: wrong number of template arguments (0, should be 1)
 N::template A<> a;
               ^
bug.cc:3:24: note: provided for 'template<int <anonymous> > struct N::A'
   template<int> struct A {};
                        ^
bug.cc:6:13: error: '<expression error>' in namespace 'N' does not name a type
 N::template A<> a;
             ^~~
bug.cc:6:13: internal compiler error: in get_string, at spellcheck-tree.h:46
0x620770 edit_distance_traits<tree_node*>::get_string(tree_node*)
        ../../gcc/gcc/spellcheck-tree.h:46
0x620770 best_match<tree_node*, char const*>::best_match(tree_node*, unsigned
int)
        ../../gcc/gcc/spellcheck.h:92
0x620770 suggest_alternative_in_explicit_scope(unsigned int, tree_node*,
tree_node*)
        ../../gcc/gcc/cp/name-lookup.c:5552
0x90cf87 cp_parser_diagnose_invalid_type_name
        ../../gcc/gcc/cp/parser.c:3370
0x9353ed cp_parser_parse_and_diagnose_invalid_type_name
        ../../gcc/gcc/cp/parser.c:3468
0x93c76f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:12946
0x93cfd8 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:12869
0x940f32 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12767
0x941341 cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12643
0x941634 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4559
0x941634 c_parse_file()
        ../../gcc/gcc/cp/parser.c:38866
0xa3f966 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1132
Please submit a full bug report, [etc.]

The regression was introduced between 2017-11-26 and 2017-12-18.

Reply via email to