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

            Bug ID: 72803
           Summary: [7 Regression] ICE on invalid code in
                    linemap_position_for_loc_and_offset, at
                    libcpp/line-map.c:891
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Starting from r238008, we ICE:

$ g++ tc.cc

tc.cc:1:64: error: expected nested-name-specifier before
‘__gnu_cxx__alloc_traitstemplate’
   template     class basic_string     {       typedef typename
__gnu_cxx__alloc_traitstemplate  rebindother _Char_alloc_type            public
                                                                               
                 static const int npos = static_cast     private          
template     class num_get  public localefacet        template      localeid
num_putid                ;        ;        ;        ;        ;        ;       
;        ;        ;        ;        ;        ;        ; }
                                                               
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tc.cc:1:64: error: expected ‘;’ at end of member declaration
tc.cc:1:97: error: ‘rebindother’ does not name a type; did you mean ‘register’?
   template     class basic_string     {       typedef typename
__gnu_cxx__alloc_traitstemplate  rebindother _Char_alloc_type            public
                                                                               
                 static const int npos = static_cast     private          
template     class num_get  public localefacet        template      localeid
num_putid                ;        ;        ;        ;        ;        ;       
;        ;        ;        ;        ;        ;        ; }
                                                                               
                 ^~~~~~~~~~~
                                                                               
                 register
tc.cc:4:127: internal compiler error: in linemap_position_for_loc_and_offset,
at libcpp/line-map.c:891
0x1543639 linemap_position_for_loc_and_offset(line_maps*, unsigned int,
unsigned int)
        ../../libcpp/line-map.c:891
0x789893 cp_parser_class_specifier_1
        ../../gcc/cp/parser.c:21506
0x789893 cp_parser_class_specifier
        ../../gcc/cp/parser.c:21657
0x789893 cp_parser_type_specifier
        ../../gcc/cp/parser.c:15883
0x79e441 cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:12802
0x7a4637 cp_parser_explicit_instantiation
        ../../gcc/cp/parser.c:15647
0x7b4fe1 cp_parser_declaration
        ../../gcc/cp/parser.c:12132
0x7b38f6 cp_parser_declaration_seq_opt
        ../../gcc/cp/parser.c:12059
0x7b3c28 cp_parser_translation_unit
        ../../gcc/cp/parser.c:4350
0x7b3c28 c_parse_file()
        ../../gcc/cp/parser.c:37549
0x916922 c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1070

$ cat tc.cc

  template     class basic_string     {       typedef typename
__gnu_cxx__alloc_traitstemplate  rebindother _Char_alloc_type            public
                                                                               
                 static const int npos = static_cast     private          
template     class num_get  public localefacet        template      localeid
num_putid                ;        ;        ;        ;        ;        ;       
;        ;        ;        ;        ;        ;        ; }
# 1 "" 1

Reply via email to