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

            Bug ID: 58565
           Summary: [c++0x] ICE with label in statement expression
           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 triggers an ICE since GCC 4.6.0 when
compiled with "-std=c++0x":

=======================
void foo()
{
  int i = ({ L: ; });
}
=======================

bug.cc: In function 'void foo()':
bug.cc:3:20: sorry, unimplemented: unexpected AST of kind label_expr
   int i = ({ L: ; });
                    ^
bug.cc:3:20: internal compiler error: in potential_constant_expression_1, at
cp/semantics.c:8958
0x6ca0f4 potential_constant_expression_1
        ../../gcc/gcc/cp/semantics.c:8958
0x647673 cp_parser_constant_expression
        ../../gcc/gcc/cp/parser.c:8208
0x65332e cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16520
0x65396f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x6557d0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x6568c0 cp_parser_declaration_statement
        ../../gcc/gcc/cp/parser.c:10514
0x63f167 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9274
0x64046e cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9552
0x6405b6 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9506
0x65196b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18318
0x65196b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18354
0x6529af cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22338
0x6536b7 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22259
0x6536b7 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16347
0x65396f cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x6557d0 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x65e7fe cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:10764
0x65d55d cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:10650
0x65ee46 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:3939
0x65ee46 c_parse_file()
        ../../gcc/gcc/cp/parser.c:28898
Please submit a full bug report, [etc.]

Without "-std=c++0x" the code is rejected correctly:

bug.cc: In function 'void foo()':
bug.cc:3:20: error: void value not ignored as it ought to be
   int i = ({ L: ; });
                    ^

Reply via email to