http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59912
Bug ID: 59912 Summary: [C++1y] ICE when deducing return type for specialized functions Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: n.sakisaka at gmail dot com // normal function, OK // auto f(int) // { // return 0; // } // specialized function, NG template<class T, class ReturnType> ReturnType f(T); template<> auto f(int) { return 0; } ICE error output: prog.cc:15:1: internal compiler error: Segmentation fault } ^ 0x95499f crash_signal /home/gccbuilder/gcc/gcc/toplev.c:337 0xb2aa12 make_decl_rtl(tree_node*) /home/gccbuilder/gcc/gcc/varasm.c:1274 0xb2b12a notice_global_symbol(tree_node*) /home/gccbuilder/gcc/gcc/varasm.c:1548 0x6e0251 cgraph_finalize_function(tree_node*, bool) /home/gccbuilder/gcc/gcc/cgraphunit.c:434 0x5fbd9f expand_or_defer_fn(tree_node*) /home/gccbuilder/gcc/gcc/cp/semantics.c:3979 0x5c2c56 cp_parser_function_definition_after_declarator /home/gccbuilder/gcc/gcc/cp/parser.c:22705 0x5c3b1c cp_parser_function_definition_from_specifiers_and_declarator /home/gccbuilder/gcc/gcc/cp/parser.c:22609 0x5c3b1c cp_parser_init_declarator /home/gccbuilder/gcc/gcc/cp/parser.c:16598 0x5c3e54 cp_parser_single_declaration /home/gccbuilder/gcc/gcc/cp/parser.c:23018 0x5c467d cp_parser_explicit_specialization /home/gccbuilder/gcc/gcc/cp/parser.c:14203 0x5cc553 cp_parser_declaration /home/gccbuilder/gcc/gcc/cp/parser.c:10941 0x5cb168 cp_parser_declaration_seq_opt /home/gccbuilder/gcc/gcc/cp/parser.c:10874 0x5cc9aa cp_parser_translation_unit /home/gccbuilder/gcc/gcc/cp/parser.c:4021 0x5cc9aa c_parse_file() /home/gccbuilder/gcc/gcc/cp/parser.c:31350 0x6758a3 c_common_parse_file() /home/gccbuilder/gcc/gcc/c-family/c-opts.c:1060 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. Working code: http://melpon.org/wandbox/permlink/WWuXWgF9W7E6bywL