Bug 42054

Summary: [4.3/4.4 Regression] ICE with invalid template parameter
Product: gcc Reporter: Volker Reichelt <reichelt>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: fang, gcc-bugs, simartin
Priority: P5 Keywords: error-recovery, ice-on-invalid-code, monitored
Version: 4.5.0   
Target Milestone: 4.5.0   
Host: Target:
Build: Known to work: 4.5.0
Known to fail: Last reconfirmed: 2009-11-22 21:53:27

Description Volker Reichelt 2009-11-15 21:09:06 UTC
The following invalid testcase triggers an ICE since GCC 4.2.0:

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

bug.cc:1:14: error: two or more data types in declaration of 'parameter'
bug.cc:2:14: error: two or more data types in declaration of 'parameter'
bug.cc:2:26: error: redefinition of default argument for '<declaration error>'
bug.cc:2:26: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'error_mark' in redeclare_class_template, at cp/pt.c:4576
Please submit a full bug report, [etc.]
Comment 1 Simon Martin 2009-11-22 21:53:27 UTC
Patch submitted here:
    http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01204.html
Comment 2 Simon Martin 2010-02-27 19:21:55 UTC
Subject: Bug 42054

Author: simartin
Date: Sat Feb 27 19:21:39 2010
New Revision: 157112

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157112
Log:
gcc/cp/

2010-02-27  Simon Martin  <simartin@users.sourceforge.net>

        PR c++/42054
        * pt.c (redeclare_class_template): Return false if there are erroneous
        template parameters.

gcc/testsuite/

2010-02-27  Simon Martin  <simartin@users.sourceforge.net>

        PR c++/42054:
	* g++.dg/parse/error37.C: New test.

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

Comment 3 Simon Martin 2010-02-27 19:28:16 UTC
Fixed in 4.5
Comment 4 Richard Biener 2010-05-22 18:13:46 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 5 Paolo Carlini 2011-06-09 16:15:29 UTC
Fixed in 4.5+?
Comment 6 Paolo Carlini 2011-06-23 18:04:15 UTC
Fixed in 4.5.0.