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

            Bug ID: 58614
           Summary: [c++11] ICE with undeclared variable in initializer
                    list
           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" or "-std=c++0x"
for older versions) triggers an ICE since GCC 4.4.0 (when initializer lists
were introduced):

===============================
#include <initializer_list>

void foo()
{
  i;
  auto j { i };
}
===============================

bug.cc: In function 'void foo()':
bug.cc:5:3: error: 'i' was not declared in this scope
   i;
   ^
bug.cc:6:14: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in maybe_adjust_types_for_deduction, at
cp/pt.c:15597
   auto j { i };
              ^
0xcd8a39 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc/gcc/tree.c:9227
0x5814af tree_class_check
        ../../gcc/gcc/tree.h:2732
0x5814af maybe_adjust_types_for_deduction
        ../../gcc/gcc/cp/pt.c:15597
0x5c45d0 unify
        ../../gcc/gcc/cp/pt.c:16914
0x5cdb8a unify_one_argument
        ../../gcc/gcc/cp/pt.c:15900
0x5c2cf2 type_unification_real
        ../../gcc/gcc/cp/pt.c:15972
0x5d69b2 do_auto_deduction(tree_node*, tree_node*, tree_node*)
        ../../gcc/gcc/cp/pt.c:21153
0x5696cd cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:6151
0x65119f cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16568
0x6518bf cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:10986
0x653740 cp_parser_block_declaration
        ../../gcc/gcc/cp/parser.c:10867
0x654860 cp_parser_declaration_statement
        ../../gcc/gcc/cp/parser.c:10514
0x63d097 cp_parser_statement
        ../../gcc/gcc/cp/parser.c:9274
0x63e3a2 cp_parser_statement_seq_opt
        ../../gcc/gcc/cp/parser.c:9552
0x63e4e6 cp_parser_compound_statement
        ../../gcc/gcc/cp/parser.c:9506
0x64f89b cp_parser_function_body
        ../../gcc/gcc/cp/parser.c:18319
0x64f89b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/gcc/cp/parser.c:18355
0x6508ef cp_parser_function_definition_after_declarator
        ../../gcc/gcc/cp/parser.c:22340
0x651605 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/gcc/cp/parser.c:22261
0x651605 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:16348
Please submit a full bug report, [etc.]

Reply via email to