https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70572
Bug ID: 70572 Summary: ICE on code with decltype (auto) on x86_64-linux-gnu in digest_init_r, at cp/typeck2.c:1103 with -std=c++14 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 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It also affects 4.9.x and later, which support -std=c++14. $ 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-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 6.0.0 20160406 (experimental) [trunk revision 234771] (GCC) $ $ g++-trunk -c -std=c++14 small.cpp small.cpp: In function ‘int foo()’: small.cpp:3:23: internal compiler error: in digest_init_r, at cp/typeck2.c:1103 decltype (auto) a = foo; // OK: decltype (auto) a = &foo; ^~~ 0x6cd59c digest_init_r ../../gcc-source-trunk/gcc/cp/typeck2.c:1099 0x6cf2ea digest_init_flags ../../gcc-source-trunk/gcc/cp/typeck2.c:1168 0x6cf2ea store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc-source-trunk/gcc/cp/typeck2.c:802 0x62fbf4 check_initializer ../../gcc-source-trunk/gcc/cp/decl.c:6162 0x659865 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int) ../../gcc-source-trunk/gcc/cp/decl.c:6810 0x752f9f cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18658 0x753750 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12379 0x753a61 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12248 0x7544b8 cp_parser_declaration_statement ../../gcc-source-trunk/gcc/cp/parser.c:11860 0x732b7b cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10528 0x73349c cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10806 0x73358f cp_parser_compound_statement ../../gcc-source-trunk/gcc/cp/parser.c:10760 0x751dcf cp_parser_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20653 0x751dcf cp_parser_ctor_initializer_opt_and_function_body ../../gcc-source-trunk/gcc/cp/parser.c:20689 0x752871 cp_parser_function_definition_after_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25351 0x753467 cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-source-trunk/gcc/cp/parser.c:25263 0x753467 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18429 0x753750 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12379 0x753a61 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12248 0x75c5d0 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12145 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. $ -------------------------------------------------------------- int foo () { decltype (auto) a = foo; // OK: decltype (auto) a = &foo; return 0; }