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

            Bug ID: 67847
           Summary: ICE on (invalid) nested enum declaration on
                    x86_64-linux-gnu in is_ancestor, at
                    cp/name-lookup.c:2771
           Product: gcc
           Version: 6.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 code causes an ICE when compiled with the current gcc trunk (and
earlier GCC versions) on x86_64-linux-gnu.  


$ 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/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20151004 (experimental) [trunk revision 228457] (GCC) 
$ 
$ g++-trunk -c small.cc
small.cc:4:11: internal compiler error: in is_ancestor, at
cp/name-lookup.c:2771
   enum T::Color {R, G, B} c; 
           ^
0x7b285c is_ancestor(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/cp/name-lookup.c:2770
0x6f1b84 cp_parser_enum_specifier
        ../../gcc-trunk/gcc/cp/parser.c:16736
0x6df7e5 cp_parser_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:15330
0x6f067b cp_parser_decl_specifier_seq
        ../../gcc-trunk/gcc/cp/parser.c:12324
0x703ef9 cp_parser_member_declaration
        ../../gcc-trunk/gcc/cp/parser.c:21718
0x6dfa34 cp_parser_member_specification_opt
        ../../gcc-trunk/gcc/cp/parser.c:21570
0x6dfa34 cp_parser_class_specifier_1
        ../../gcc-trunk/gcc/cp/parser.c:20762
0x6dfa34 cp_parser_class_specifier
        ../../gcc-trunk/gcc/cp/parser.c:20998
0x6dfa34 cp_parser_type_specifier
        ../../gcc-trunk/gcc/cp/parser.c:15358
0x6f067b cp_parser_decl_specifier_seq
        ../../gcc-trunk/gcc/cp/parser.c:12324
0x702828 cp_parser_single_declaration
        ../../gcc-trunk/gcc/cp/parser.c:25124
0x702bbb cp_parser_template_declaration_after_parameters
        ../../gcc-trunk/gcc/cp/parser.c:24816
0x7037a4 cp_parser_explicit_template_declaration
        ../../gcc-trunk/gcc/cp/parser.c:25051
0x7037a4 cp_parser_template_declaration_after_export
        ../../gcc-trunk/gcc/cp/parser.c:25069
0x70c179 cp_parser_declaration
        ../../gcc-trunk/gcc/cp/parser.c:11691
0x70a53a cp_parser_declaration_seq_opt
        ../../gcc-trunk/gcc/cp/parser.c:11613
0x70a880 cp_parser_translation_unit
        ../../gcc-trunk/gcc/cp/parser.c:4169
0x70a880 c_parse_file()
        ../../gcc-trunk/gcc/cp/parser.c:34599
0x857542 c_common_parse_file()
        ../../gcc-trunk/gcc/c-family/c-opts.c:1064
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 T > 
class D
{
  enum T::Color {R, G, B} c; 
};

Reply via email to