Bug 28594 - [4.2 regression] ICE with invalid template parameter
Summary: [4.2 regression] ICE with invalid template parameter
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P4 normal
Target Milestone: 4.2.0
Assignee: Lee Millward
URL:
Keywords: error-recovery, ice-on-invalid-code, monitored
Depends on:
Blocks: 27668
  Show dependency treegraph
 
Reported: 2006-08-04 00:48 UTC by Volker Reichelt
Modified: 2006-08-26 03:40 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-04 08:10:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2006-08-04 00:48:20 UTC
The following invalid code snippet triggers an ICE on the 4.1 branch
and mainline:

===============================
template<void, int> struct A;
===============================

bug6.cc:1: error: 'void' is not a valid type for a template constant parameter
bug6.cc:1: internal compiler error: tree check: expected tree_list, have error_mark in process_template_parm, at cp/pt.c:2359
Please submit a full bug report, [etc.]

This is fallout from PR 27668.
Comment 1 Lee Millward 2006-08-04 08:10:34 UTC
I'll take a look at it.
Comment 2 patchapp@dberlin.org 2006-08-05 14:55:15 UTC
Subject: Bug number PR c++/28594

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-08/msg00124.html
Comment 3 Lee Millward 2006-08-10 19:19:04 UTC
Subject: Bug 28594

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

Comment 4 Lee Millward 2006-08-10 19:22:24 UTC
Fixed on the 4.1 branch by the reversal of the patch for PR 27668.
Comment 5 Lee Millward 2006-08-15 17:21:49 UTC
Subject: Bug 28594

Author: lmillward
Date: Tue Aug 15 17:21:09 2006
New Revision: 116160

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116160
Log:
	PR c++/28594
	* pt.c (process_template_parm): Robustify.
	* g++.dg/template/void6.C: New test.


Added:
    trunk/gcc/testsuite/g++.dg/template/void6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Lee Millward 2006-08-15 17:22:28 UTC
Fixed on mainline.