https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70286
Bug ID: 70286 Summary: ICE on template specialization Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: rippey.e at gmail dot com Target Milestone: --- When the following code: template<int>struct A B; template<>struct B<>: is run with g++ 5.3.0, with the argument "--std=c++14", the following is produced: a.cpp:2:18: internal compiler error: Segmentation fault template<>struct B<>: ^ 0xacecef crash_signal /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/toplev.c:383 0x66180e maybe_process_partial_specialization(tree_node*) /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/pt.c:834 0x696177 cp_parser_class_head /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:20428 0x696177 cp_parser_class_specifier_1 /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:19816 0x696177 cp_parser_class_specifier /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:20108 0x696177 cp_parser_type_specifier /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:14727 0x6a9a87 cp_parser_decl_specifier_seq /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:11958 0x6ae998 cp_parser_single_declaration /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:23776 0x6af33d cp_parser_explicit_specialization /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:14623 0x691bbf cp_parser_declaration /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:11332 0x6b87ea cp_parser_declaration_seq_opt /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:11265 0x6b8aff cp_parser_translation_unit /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:4100 0x6b8aff c_parse_file() /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:33229 0x76bb92 c_common_parse_file() /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/c-family/c-opts.c:1057 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. A similar report is produced if the compiler is given the flag "--std=c++11": a.cpp:1:23: warning: variable templates only available with -std=c++14 or -std=gnu++14 template<int>struct A B; ^ a.cpp:2:18: internal compiler error: Segmentation fault template<>struct B<>: ^ 0xacecef crash_signal /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/toplev.c:383 0x66180e maybe_process_partial_specialization(tree_node*) /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/pt.c:834 0x696177 cp_parser_class_head /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:20428 0x696177 cp_parser_class_specifier_1 /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:19816 0x696177 cp_parser_class_specifier /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:20108 0x696177 cp_parser_type_specifier /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:14727 0x6a9a87 cp_parser_decl_specifier_seq /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:11958 0x6ae998 cp_parser_single_declaration /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:23776 0x6af33d cp_parser_explicit_specialization /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:14623 0x691bbf cp_parser_declaration /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:11332 0x6b87ea cp_parser_declaration_seq_opt /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:11265 0x6b8aff cp_parser_translation_unit /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:4100 0x6b8aff c_parse_file() /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/cp/parser.c:33229 0x76bb92 c_common_parse_file() /disk/0/erippey/gcc/objdir/../gcc-5.3.0/gcc/c-family/c-opts.c:1057 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. Running gcc 4.8.5 with "--std=c++11" does not produce an ICE.