$ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160918 (experimental) [trunk revision 240220] (GCC) $ $ g++-trunk small.C small.C:2:35: error: an explicit specialization must be preceded by ‘template <>’ template <class T, int a, class U struct B<T, a, U, 1> {}; ^~~~~~~~~~~~~~~~~~~~ template <> small.C:2:42: error: enclosing class templates are not explicitly specialized template <class T, int a, class U struct B<T, a, U, 1> {}; ^~~~~~~~~~~~~ small.C:2:56: error: types may not be defined in parameter types template <class T, int a, class U struct B<T, a, U, 1> {}; ^ small.C:2:56: error: definition of ‘struct B<T, a, U, 1>’ inside template parameter list small.C:2:57: error: two or more data types in declaration of ‘parameter’ template <class T, int a, class U struct B<T, a, U, 1> {}; ^ small.C:2:58: error: expected ‘>’ before ‘;’ token template <class T, int a, class U struct B<T, a, U, 1> {}; ^ small.C:2:58: error: expected unqualified-id before ‘;’ token small.C:3:20: internal compiler error: tree check: accessed elt 1 of tree_vec with 0 elts in unify, at cp/pt.c:19674 B<int, 2, char, 1> i; ^ 0x107f2b5 tree_vec_elt_check_failed(int, int, char const*, int, char const*) ../../gcc-source-trunk/gcc/tree.c:9939 0x6f2572 tree_vec_elt_check ../../gcc-source-trunk/gcc/tree.h:3247 0x6f2572 unify ../../gcc-source-trunk/gcc/cp/pt.c:19674 0x6f1915 unify ../../gcc-source-trunk/gcc/cp/pt.c:20081 0x6f4156 get_partial_spec_bindings ../../gcc-source-trunk/gcc/cp/pt.c:20851 0x6eb961 most_specialized_partial_spec ../../gcc-source-trunk/gcc/cp/pt.c:21107 0x707005 instantiate_class_template_1 ../../gcc-source-trunk/gcc/cp/pt.c:9848 0x707005 instantiate_class_template(tree_node*) ../../gcc-source-trunk/gcc/cp/pt.c:10416 0x7adbcb complete_type(tree_node*) ../../gcc-source-trunk/gcc/cp/typeck.c:133 0x66b315 start_decl_1(tree_node*, bool) ../../gcc-source-trunk/gcc/cp/decl.c:5168 0x6944bf start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc-source-trunk/gcc/cp/decl.c:5131 0x79a089 cp_parser_init_declarator ../../gcc-source-trunk/gcc/cp/parser.c:18701 0x79aae7 cp_parser_simple_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12495 0x79ae66 cp_parser_block_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12363 0x7a3d14 cp_parser_declaration ../../gcc-source-trunk/gcc/cp/parser.c:12260 0x7a28af cp_parser_declaration_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:12139 0x7a2bf8 cp_parser_translation_unit ../../gcc-source-trunk/gcc/cp/parser.c:4356 0x7a2bf8 c_parse_file() ../../gcc-source-trunk/gcc/cp/parser.c:37714 0x917b92 c_common_parse_file() ../../gcc-source-trunk/gcc/c-family/c-opts.c:1073 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. $ $ cat small.C template <class, int, class, int> struct B {}; template <class T, int a, class U struct B<T, a, U, 1> {}; B<int, 2, char, 1> i; $
GCC 5 doesn't ICE.
Started with r225706.
Author: ppalka Date: Mon Sep 19 18:12:36 2016 New Revision: 240245 URL: https://gcc.gnu.org/viewcvs?rev=240245&root=gcc&view=rev Log: Fix PR c++/77639 (ICE during error recovery) gcc/cp/ChangeLog: PR c++/77639 * parser.c (cp_parser_class_head): When processing_template_parmlist, don't assume that the class-head may start an explicit specialization. gcc/testsuite/ChangeLog: PR c++/77639 * g++.dg/template/error-recovery4.C: New test. Added: trunk/gcc/testsuite/g++.dg/template/error-recovery4.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/parser.c trunk/gcc/testsuite/ChangeLog
GCC 6.3 is being released, adjusting target milestone.
GCC 6.4 is being released, adjusting target milestone.
GCC 6 branch is being closed, fixed in 7.x.