https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64129
Bug ID: 64129 Summary: [5.0 regression] ICE on invalid: in grokfndecl, at cp/decl.c:7658 Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dimhen at gmail dot com r218182 FAIL r214718 FAIL (different stack) r214134 PASS $ cat x.ii template <0> int __copy_streambufs_eof; class { friend __copy_streambufs_eof <> ( $ /usr/local/gcc_current/bin/g++ -fpreprocessed -fsyntax-only x.ii x.ii:1:11: error: expected identifier before numeric constant template <0> int __copy_streambufs_eof; ^ x.ii:1:11: error: expected '>' before numeric constant x.ii:1:18: warning: variable templates only available with -std=c++14 or -std=gnu++14 template <0> int __copy_streambufs_eof; ^ x.ii:3:35: error: wrong number of template arguments (0, should be 1) friend __copy_streambufs_eof <> ( ^ x.ii:1:18: note: provided for 'template<int <anonymous> > int __copy_streambufs_eof<<anonymous> >' template <0> int __copy_streambufs_eof; ^ x.ii:3:37: error: expected identifier at end of input friend __copy_streambufs_eof <> ( ^ x.ii:3:37: error: expected ',' or '...' at end of input x.ii:3:37: error: expected ')' at end of input x.ii:3:37: error: ISO C++ forbids declaration of '__copy_streambufs_eof' with no type [-fpermissive] x.ii:3:37: internal compiler error: in grokfndecl, at cp/decl.c:7658 0x5eb4c5 grokfndecl /home/dimhen/src/gcc_current/gcc/cp/decl.c:7658 0x5e01c9 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*, decl_context, int, tree_node**) /home/dimhen/src/gcc_current/gcc/cp/decl.c:10716 0x68d006 grokfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*, bool, tree_node*, tree_node*) /home/dimhen/src/gcc_current/gcc/cp/decl2.c:875 0x6cfd2d cp_parser_member_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:20992 0x6abb05 cp_parser_member_specification_opt /home/dimhen/src/gcc_current/gcc/cp/parser.c:20544 0x6abb05 cp_parser_class_specifier_1 /home/dimhen/src/gcc_current/gcc/cp/parser.c:19736 0x6abb05 cp_parser_class_specifier /home/dimhen/src/gcc_current/gcc/cp/parser.c:19972 0x6abb05 cp_parser_type_specifier /home/dimhen/src/gcc_current/gcc/cp/parser.c:14632 0x6ae33f cp_parser_decl_specifier_seq /home/dimhen/src/gcc_current/gcc/cp/parser.c:11867 0x6ce139 cp_parser_simple_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:11457 0x6ce693 cp_parser_block_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:11406 0x6af939 cp_parser_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:11303 0x6dbe7a cp_parser_declaration_seq_opt /home/dimhen/src/gcc_current/gcc/cp/parser.c:11189 0x6dc1b7 cp_parser_translation_unit /home/dimhen/src/gcc_current/gcc/cp/parser.c:4101 0x6dc1b7 c_parse_file() /home/dimhen/src/gcc_current/gcc/cp/parser.c:32199 0x8124a2 c_common_parse_file() /home/dimhen/src/gcc_current/gcc/c-family/c-opts.c:1039 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. $ /usr/local/gcc_current/bin/gcc -v Using built-in specs. COLLECT_GCC=/usr/local/gcc_current/bin/gcc COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current/ --enable-checking=yes,df,rtl --enable-languages=c,c++,lto --enable-plugin=yes --enable-static Thread model: posix gcc version 5.0.0 20141129 (experimental) [trunk revision 218182] (GCC) $ ~/bin/gcc_214718/bin/g++ -fpreprocessed -fsyntax-only x.ii x.ii:1:11: error: expected identifier before numeric constant template <0> int __copy_streambufs_eof; ^ x.ii:1:11: error: expected '>' before numeric constant x.ii:1:18: warning: variable templates only available with -std=c++14 or -std=gnu++14 template <0> int __copy_streambufs_eof; ^ x.ii:3:35: internal compiler error: Segmentation fault friend __copy_streambufs_eof <> ( ^ 0xc6025f crash_signal /home/dimhen/src/gcc_current/gcc/toplev.c:339 0x5d1dee uses_template_parms(tree_node*) /home/dimhen/src/gcc_current/gcc/cp/pt.c:8239 0x5d3a93 lookup_template_variable(tree_node*, tree_node*) /home/dimhen/src/gcc_current/gcc/cp/pt.c:7978 0x697c0a cp_parser_template_id /home/dimhen/src/gcc_current/gcc/cp/parser.c:13636 0x697d95 cp_parser_class_name /home/dimhen/src/gcc_current/gcc/cp/parser.c:19386 0x68bfd9 cp_parser_qualifying_entity /home/dimhen/src/gcc_current/gcc/cp/parser.c:5564 0x68bfd9 cp_parser_nested_name_specifier_opt /home/dimhen/src/gcc_current/gcc/cp/parser.c:5289 0x69af2b cp_parser_constructor_declarator_p /home/dimhen/src/gcc_current/gcc/cp/parser.c:22870 0x69af2b cp_parser_decl_specifier_seq /home/dimhen/src/gcc_current/gcc/cp/parser.c:11733 0x6a1636 cp_parser_member_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:20477 0x67fe4c cp_parser_member_specification_opt /home/dimhen/src/gcc_current/gcc/cp/parser.c:20332 0x67fe4c cp_parser_class_specifier_1 /home/dimhen/src/gcc_current/gcc/cp/parser.c:19522 0x682860 cp_parser_class_specifier /home/dimhen/src/gcc_current/gcc/cp/parser.c:19758 0x682860 cp_parser_type_specifier /home/dimhen/src/gcc_current/gcc/cp/parser.c:14507 0x69adb4 cp_parser_decl_specifier_seq /home/dimhen/src/gcc_current/gcc/cp/parser.c:11748 0x6a0d69 cp_parser_simple_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:11338 0x684a93 cp_parser_block_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:11287 0x6ab465 cp_parser_declaration /home/dimhen/src/gcc_current/gcc/cp/parser.c:11184 0x6aa118 cp_parser_declaration_seq_opt /home/dimhen/src/gcc_current/gcc/cp/parser.c:11070 0x6ab9b3 cp_parser_translation_unit /home/dimhen/src/gcc_current/gcc/cp/parser.c:4053 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. $ ~/bin/gcc_214718/bin/g++ -v Using built-in specs. COLLECT_GCC=/home/dimhen/bin/gcc_214718/bin/g++ COLLECT_LTO_WRAPPER=/home/dimhen/bin/gcc_214718/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current/ --enable-checking=yes,df,rtl,tree,fold --enable-languages=c,c++,lto --enable-plugin=yes --enable-static Thread model: posix gcc version 5.0.0 20140829 (experimental) [trunk revision 214718] (GCC)