Bug 9216 - [3.2 regression] ICE on missing template parameter
Summary: [3.2 regression] ICE on missing template parameter
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.2.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2003-01-07 04:46 UTC by o.kullmann
Modified: 2003-07-25 17:33 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description o.kullmann 2003-01-07 04:46:01 UTC
Error message:

> g++ Fehler.cpp
Fehler.cpp: In function `int main()':
Fehler.cpp:6: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

where Fehler.cpp is in How-to-Repeat.

Release:
gcc 3.2.1

Environment:
Linux (Suse 8.0)
> g++ -v
Reading specs from /compsci/partition1/csoliver/GCC/gcc-3.2.1/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/specs
Configured with: /compsci/partition1/csoliver/GCC/gcc-3.2.1/configure --enable-threads=posix --enable-long-lo
ng --prefix=/compsci/partition1/csoliver/GCC/gcc-3.2.1 --with-local-prefix=/compsci/partition1/csoliver/GCC/I
nclude_3.2.1 --enable-languages=c,c++ --disable-nls --enable-shared
Thread model: posix
gcc version 3.2.1

How-To-Repeat:
namespace N {
  template < typename T > class C : T {};
}

int main() {
 N::C();
}
Comment 1 o.kullmann 2003-01-07 04:46:01 UTC
Fix:
not known
Comment 2 Volker Reichelt 2003-01-07 06:41:09 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.
    
    gcc 2.95.x and the 3.3 branch emit the following error messages:
    
    gcc 2.95.x: 
      bug.cc:6: invalid use of `template <class T> N::C<T>'
    gcc 3.3-20021230:
      bug.cc:6: error: invalid use of `template<class T> class N::C'
    
    With gcc 3.0.x, 3.1.x, 3.2.x we get an ICE which is clearly a regression
    on the 3.2 branch.
    
    With the new parser we get the following error message:
    
    bug.cc:6: error: expected primary-expression
    
    which is less descriptive than the error message in gcc 2.95.x, 3.3 branch.
    IMHO this is also a regression (although not a very severe one).
Comment 3 Mark Mitchell 2003-01-23 06:05:21 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/9216
Date: 23 Jan 2003 06:05:21 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-01-23 06:05:21
 
 Modified files:
 	gcc/cp         : ChangeLog init.c parser.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: new1.C template2.C typedef2.C 
 
 Log message:
 	PR c++/9354
 	* init.c (build_new): Set the type of the new-expression, even
 	when processing_templte_decl.
 	
 	PR c++/9216
 	* parser.c (cp_parser_primary_expression): Improve error message
 	for templates used in an expression context.
 	
 	PR c++/8696
 	* parser.c (cp_parser_decl_specifier_seq): Commit to tentative
 	parse when encountering "typedef".
 	
 	PR c++/9354
 	* g++.dg/parse/new1.C: New test.
 	
 	PR c++/9216
 	* g++.dg/parse/template2.C: New test.
 	
 	PR c++/9354
 	* g++.dg/parse/typedef2.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3174&r2=1.3175
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.306&r2=1.307
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.37&r2=1.38
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2363&r2=1.2364
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/new1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/template2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/typedef2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 

Comment 4 Mark Mitchell 2003-01-23 06:05:21 UTC
From: mmitchel@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/9216
Date: 23 Jan 2003 06:05:21 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	mmitchel@gcc.gnu.org	2003-01-23 06:05:21
 
 Modified files:
 	gcc/cp         : ChangeLog init.c parser.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: new1.C template2.C typedef2.C 
 
 Log message:
 	PR c++/9354
 	* init.c (build_new): Set the type of the new-expression, even
 	when processing_templte_decl.
 	
 	PR c++/9216
 	* parser.c (cp_parser_primary_expression): Improve error message
 	for templates used in an expression context.
 	
 	PR c++/8696
 	* parser.c (cp_parser_decl_specifier_seq): Commit to tentative
 	parse when encountering "typedef".
 	
 	PR c++/9354
 	* g++.dg/parse/new1.C: New test.
 	
 	PR c++/9216
 	* g++.dg/parse/template2.C: New test.
 	
 	PR c++/9354
 	* g++.dg/parse/typedef2.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3174&r2=1.3175
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/init.c.diff?cvsroot=gcc&r1=1.306&r2=1.307
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.37&r2=1.38
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2363&r2=1.2364
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/new1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/template2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/typedef2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 
Comment 5 Joe Buck 2003-04-25 21:01:38 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.