The following invalid code snippet triggers an ICE since GCC 3.4.0: ================================================== template<typename class T, T = T()> struct A {}; template<int> void foo(A<int>); ================================================== bug.cc:1: error: expected nested-name-specifier before 'class' bug.cc:1: error: two or more data types in declaration of 'parameter' bug.cc:1: error: 'struct T' is not a valid type for a template constant parameter bug.cc:3: error: type/value mismatch at argument 1 in template parameter list for 'template<int <anonymous>, void <anonymous> > struct A' bug.cc:3: error: expected a constant of type 'int', got 'int' bug.cc:3: internal compiler error: in value_dependent_expression_p, at cp/pt.c:12489 Please submit a full bug report, [etc.]
Confirmed.
Subject: Bug number PR c++/27668 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00868.html
Subject: Bug number PR c++/27668 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-07/msg01130.html
Subject: Bug 27668 Author: lmillward Date: Fri Jul 28 17:01:19 2006 New Revision: 115800 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115800 Log: PR c++/27668 PR c++/27962 * pt.c (process_template_parm) Store invalid template parameters as error_mark_node in the paramater list. (push_inline_template_parms_recursive): Handle invalid template parameters. (comp_template_parms): Likewise. (check_default_tmpl_arg): Likewise. (coerce_template_template_parms): Likewise. (mangle_class_name_for_template): Likewise. (tsubst_template_parms): Likewise. * error.c (dump_template_argument_list): Likewise. * g++.dg/template/crash55.C: New test. * g++.dg/template/nontype16.C: New test. * g++.dg/template/void2.C: Adjust error markers. * g++.dg/template/nontype5.C: Adjust error markers. Added: trunk/gcc/testsuite/g++.dg/template/crash55.C trunk/gcc/testsuite/g++.dg/template/nontype16.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/error.c trunk/gcc/cp/pt.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/template/nontype5.C trunk/gcc/testsuite/g++.dg/template/void2.C
Fixed on mainline. Will apply to 4.1 branch when testing completes.
Subject: Bug 27668 Author: lmillward Date: Fri Jul 28 21:17:28 2006 New Revision: 115801 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115801 Log: PR c++/27668 PR c++/27962 * pt.c (process_template_parm) Store invalid template parameters as error_mark_node in the paramater list. (push_inline_template_parms_recursive): Handle invalid template parameters. (comp_template_parms): Likewise. (check_default_tmpl_args): Likewise. (coerce_template_template_parms): Likewise. (coerce_template_parms): Likewise. (mangle_class_name_for_template): Likewise. (tsubst_template_parms): Likewise. * error.c (dump_template_argument_list): Likewise. * g++.dg/template/crash54.C: New test. * g++.dg/template/nontype16.C: New test. * g++.dg/template/nontype5.C: Adjust error markers. Added: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/crash54.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/nontype16.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/error.c branches/gcc-4_1-branch/gcc/cp/pt.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/nontype5.C
Fixed in 4.1.2
Subject: Bug 27668 Author: lmillward Date: Thu Aug 10 19:18:37 2006 New Revision: 116068 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116068 Log: PR c++/28594 PR c++/28637 PR c++/28638 PR c++/28639 PR c++/28640 PR c++/28641 Revert: 2006-07-28 Lee Millward <lee.millward@codesourcery.com> PR c++/27668 PR c++/27962 * pt.c (process_template_parm) Store invalid template parameters as error_mark_node in the paramater list. (push_inline_template_parms_recursive): Handle invalid template parameters. (comp_template_parms): Likewise. (check_default_tmpl_args): Likewise. (coerce_template_template_parms): Likewise. (coerce_template_parms): Likewise. (mangle_class_name_for_template): Likewise. (tsubst_template_parms): Likewise. * error.c (dump_template_argument_list): Likewise. * g++.dg/template/crash54.C: New test. * g++.dg/template/nontype16.C: New test. * g++.dg/template/nontype5.C: Adjust error markers Removed: branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/crash54.C branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/nontype16.C Modified: branches/gcc-4_1-branch/gcc/cp/ChangeLog branches/gcc-4_1-branch/gcc/cp/error.c branches/gcc-4_1-branch/gcc/cp/pt.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/g++.dg/template/nontype5.C
The patch for this bug has been reverted on the 4.1 branch so re-adding the 4.1 regression marker.
I cannot duplicate this bug with gcc 4.1.1 or with the current 4.1 or 4.2 branches. I don't get an ICE, just the expected error messages. Is this bug still present?
Won't fix in GCC-4.0.x. Adjusting milestone conservatively. It is not even sure it is still present on gcc-4_1- branch.
The ICE is still present on the 4.1 branch as of 2007-02-02. It's been fixed on the 4.2 branch and mainline.
*** Bug 32320 has been marked as a duplicate of this bug. ***
Closing 4.1 branch.