https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67339
Bug ID: 67339 Summary: Segfault when parsing a typename involving a template-alias Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: roger.ferrer at bsc dot es Target Milestone: --- Created attachment 36250 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36250&action=edit Small testcase Hi, the following snippet crashes in trunk (6.0.0 20150824). -- test.ii template < typename T> struct A { void foo(); template < typename S, typename W > using N = void (T::*)(S, W) const ; }; template < typename T> void A<T>::foo() { typename A<T>::template N<int, int> fun = &T::out; } -- end of test.ii $ g++ --version g++ (GCC) 6.0.0 20150824 (experimental) $ g++ -c test.ii test.ii: In member function 'void A<T>::foo()': test.ii:12:29: internal compiler error: Segmentation fault typename A<T>::template N<int, int> fun = &T::out; ^ 0xc7cf1f crash_signal ../../gcc-svn/gcc/toplev.c:352 0x6efffd cp_parser_elaborated_type_specifier ../../gcc-svn/gcc/cp/parser.c:16189 0x6de047 cp_parser_type_specifier ../../gcc-svn/gcc/cp/parser.c:15104 0x6edf01 cp_parser_decl_specifier_seq ../../gcc-svn/gcc/cp/parser.c:12042 0x7025a1 cp_parser_simple_declaration ../../gcc-svn/gcc/cp/parser.c:11608 0x6fbf54 cp_parser_block_declaration ../../gcc-svn/gcc/cp/parser.c:11555 0x6fcd61 cp_parser_declaration_statement ../../gcc-svn/gcc/cp/parser.c:11174 0x6fdb8c cp_parser_statement ../../gcc-svn/gcc/cp/parser.c:9894 0x6fe162 cp_parser_statement_seq_opt ../../gcc-svn/gcc/cp/parser.c:10172 0x6fe2bb cp_parser_compound_statement ../../gcc-svn/gcc/cp/parser.c:10126 0x6fe4eb cp_parser_function_body ../../gcc-svn/gcc/cp/parser.c:19783 0x6fe4eb cp_parser_ctor_initializer_opt_and_function_body ../../gcc-svn/gcc/cp/parser.c:19819 0x6ff369 cp_parser_function_definition_after_declarator ../../gcc-svn/gcc/cp/parser.c:24426 0x70022c cp_parser_function_definition_from_specifiers_and_declarator ../../gcc-svn/gcc/cp/parser.c:24338 0x70022c cp_parser_init_declarator ../../gcc-svn/gcc/cp/parser.c:17619 0x7005ae cp_parser_single_declaration ../../gcc-svn/gcc/cp/parser.c:24868 0x70074b cp_parser_template_declaration_after_parameters ../../gcc-svn/gcc/cp/parser.c:24487 0x701334 cp_parser_explicit_template_declaration ../../gcc-svn/gcc/cp/parser.c:24722 0x701334 cp_parser_template_declaration_after_export ../../gcc-svn/gcc/cp/parser.c:24740 0x708109 cp_parser_declaration ../../gcc-svn/gcc/cp/parser.c:11412 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. It looks like a regression introduced in 5.1: both GCC 5.1.0 and GCC 5.2.0 crash while 4.9.3 works fine. Best regards,