https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87616
--- Comment #1 from Michael Gorbovitski <mickg at mickg dot net> --- > g++ prog.cc -Wall -Wextra prog.cc:8:36: internal compiler error: Segmentation fault 8 | friend class friender<X,Y>::cls; | ^ 0xb3ffff crash_signal ../../source/gcc/toplev.c:325 0x644fc3 make_friend_class(tree_node*, tree_node*, bool) ../../source/gcc/cp/friend.c:406 0x6a409f cp_parser_template_declaration_after_parameters ../../source/gcc/cp/parser.c:27052 0x6a4421 cp_parser_explicit_template_declaration ../../source/gcc/cp/parser.c:27271 0x6a4421 cp_parser_template_declaration_after_export ../../source/gcc/cp/parser.c:27290 0x6913bd cp_parser_member_declaration ../../source/gcc/cp/parser.c:23593 0x6921c0 cp_parser_member_specification_opt ../../source/gcc/cp/parser.c:23520 0x6921c0 cp_parser_class_specifier_1 ../../source/gcc/cp/parser.c:22664 0x693a9b cp_parser_class_specifier ../../source/gcc/cp/parser.c:22926 0x693a9b cp_parser_type_specifier ../../source/gcc/cp/parser.c:16910 0x69f4b8 cp_parser_decl_specifier_seq ../../source/gcc/cp/parser.c:13747 0x6a4780 cp_parser_simple_declaration ../../source/gcc/cp/parser.c:13057 0x6a8272 cp_parser_declaration ../../source/gcc/cp/parser.c:12876 0x6a89a6 cp_parser_translation_unit ../../source/gcc/cp/parser.c:4631 0x6a89a6 c_parse_file() ../../source/gcc/cp/parser.c:39116 0x75db8b c_common_parse_file() ../../source/gcc/c-family/c-opts.c:1139 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. 1