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

            Bug ID: 58873
           Summary: [c++11] ICE with __underlying_type for broken enum
           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") triggers an ICE
since GCC 4.7.0 (when __underlying_type was introduced):

===================================
enum A : enum { };

template<typename> struct B {};

B<__underlying_type(A)> b;
===================================

bug.cc:1:17: error: underlying type '<anonymous enum>' of 'A' must be an
integral type
 enum A : enum { };
                 ^
bug.cc:5:22: internal compiler error: Segmentation fault
 B<__underlying_type(A)> b;
                      ^
0xb1988f crash_signal
        ../../gcc/gcc/toplev.c:335
0x654b3a cp_parser_functional_cast
        ../../gcc/gcc/cp/parser.c:22866
0x64ef5d cp_parser_postfix_expression
        ../../gcc/gcc/cp/parser.c:5792
0x65171d cp_parser_unary_expression
        ../../gcc/gcc/cp/parser.c:7066
0x6522ef cp_parser_binary_expression
        ../../gcc/gcc/cp/parser.c:7758
0x6527cf cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:7996
0x652c24 cp_parser_assignment_expression
        ../../gcc/gcc/cp/parser.c:8046
0x652c24 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8256
0x65cc73 cp_parser_template_argument
        ../../gcc/gcc/cp/parser.c:13859
0x65cc73 cp_parser_template_argument_list
        ../../gcc/gcc/cp/parser.c:13582
0x65cc73 cp_parser_enclosed_template_argument_list
        ../../gcc/gcc/cp/parser.c:22998
0x65dc2a cp_parser_template_id
        ../../gcc/gcc/cp/parser.c:13280
0x65e252 cp_parser_class_name
        ../../gcc/gcc/cp/parser.c:18853
0x65026f cp_parser_qualifying_entity
        ../../gcc/gcc/cp/parser.c:5499
0x65026f cp_parser_nested_name_specifier_opt
        ../../gcc/gcc/cp/parser.c:5224
0x65eac7 cp_parser_constructor_declarator_p
        ../../gcc/gcc/cp/parser.c:22204
0x65eac7 cp_parser_decl_specifier_seq
        ../../gcc/gcc/cp/parser.c:11393
0x6654f9 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10998
0x6495e0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10947
0x6708fe cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10844
Please submit a full bug report, [etc.]

Reply via email to