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



             Bug #: 56177

           Summary: ICE when used forward for 'auto f();'

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: i.nix...@gmail.com





Working code:

#include <iostream>

//auto f();

auto f() { return 33; }

int main() {

   std::cout << f() << std::endl;

}



Problematic code:

#include <iostream>

auto f();

auto f() { return 33; }

int main() {

   std::cout << f() << std::endl;

}



Compiler output:

source.cpp: In function 'auto f()':

source.cpp:4:19: internal compiler error: in check_return_expr, at

cp/typeck.c:8159

auto f() { return 33; }

^

0x5858ac check_return_expr(tree_node*, bool*)

../../gcc-4.8-20130127/gcc/cp/typeck.c:8159

0x5a31ae finish_return_stmt(tree_node*)

../../gcc-4.8-20130127/gcc/cp/semantics.c:782

0x55a0d1 cp_parser_jump_statement

../../gcc-4.8-20130127/gcc/cp/parser.c:10041

0x55a0d1 cp_parser_statement

../../gcc-4.8-20130127/gcc/cp/parser.c:8769

0x55a9e6 cp_parser_statement_seq_opt

../../gcc-4.8-20130127/gcc/cp/parser.c:9133

0x55aab6 cp_parser_compound_statement

../../gcc-4.8-20130127/gcc/cp/parser.c:9087

0x56e686 cp_parser_function_body

../../gcc-4.8-20130127/gcc/cp/parser.c:17672

0x56e686 cp_parser_ctor_initializer_opt_and_function_body

../../gcc-4.8-20130127/gcc/cp/parser.c:17708

0x56f6c9 cp_parser_function_definition_after_declarator

../../gcc-4.8-20130127/gcc/cp/parser.c:21680

0x5700f1 cp_parser_function_definition_from_specifiers_and_declarator

../../gcc-4.8-20130127/gcc/cp/parser.c:21601

0x5700f1 cp_parser_init_declarator

../../gcc-4.8-20130127/gcc/cp/parser.c:15810

0x57045a cp_parser_simple_declaration

../../gcc-4.8-20130127/gcc/cp/parser.c:10561

0x5750b7 cp_parser_block_declaration

../../gcc-4.8-20130127/gcc/cp/parser.c:10442

0x5750b7 cp_parser_block_declaration

../../gcc-4.8-20130127/gcc/cp/parser.c:10368

0x57a11b cp_parser_declaration

../../gcc-4.8-20130127/gcc/cp/parser.c:10339

0x578da7 cp_parser_declaration_seq_opt

../../gcc-4.8-20130127/gcc/cp/parser.c:10225

0x57a652 cp_parser_translation_unit

../../gcc-4.8-20130127/gcc/cp/parser.c:3807

0x57a652 c_parse_file()

../../gcc-4.8-20130127/gcc/cp/parser.c:28175

0x612894 c_common_parse_file()

../../gcc-4.8-20130127/gcc/c-family/c-opts.c:1036

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.





Online test: http://liveworkspace.org/code/3bTktL$0

Reply via email to