Bug 2862 - gcc accepts invalid explicit instantiation syntax
Summary: gcc accepts invalid explicit instantiation syntax
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Kriang Lerdsuwanakij
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2001-05-18 01:16 UTC by wolfgang.bangerth
Modified: 2003-07-25 17:33 UTC (History)
2 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 wolfgang.bangerth 2001-05-18 01:16:01 UTC
gcc accepts the following syntax for explicit instantiations
of template functions with default args:
---------------------------------------
template <int dim> void f    (int=0) {};
template           void f<1> ();
---------------------------------------
This is most certainly not correct.
Regards
  Wolfgang

Release:
unknown

Environment:
gcc 2.95, gcc cvs of May 05

How-To-Repeat:
-----/gcc-bugs> cat a.cc
template <int dim> void f    (int=0) {};
template           void f<1> ();

-----/gcc-bugs> ~/Config/gcc-ss-sun/bin/gcc -W -Wall -ansi -c a.cc -o /dev/null
-----/gcc-bugs> ~/Config/gcc-ss-sun/bin/gcc -v                                 
Reading specs from /home/atlas2/wolf/Config/gcc-ss-sun/bin/../lib/gcc-lib/sparc-sun-solaris2.7/3.0/specs
Configured with: ../gcc/configure --prefix=/home/people/wolf/Config/gcc-ss-sun --with-gnu-as --with-as=/usr/local/bin/as --with-gnu-ld --with-ld=/usr/local/bin/ld
Thread model: posix
gcc version 3.0 20010514 (prerelease)
Comment 1 Nathan Sidwell 2001-05-27 09:40:25 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: confirmed
Comment 2 Nathan Sidwell 2001-05-27 16:40:25 UTC
From: nathan@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org,
  wolfgang.bangerth@iwr.uni-heidelberg.de
Cc:  
Subject: Re: c++/2862
Date: 27 May 2001 16:40:25 -0000

 Synopsis: gcc accepts invalid explicit instantiation syntax
 
 State-Changed-From-To: open->analyzed
 State-Changed-By: nathan
 State-Changed-When: Sun May 27 09:40:25 2001
 State-Changed-Why:
     confirmed
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2862&database=gcc
Comment 3 Kriang Lerdsuwanakij 2002-06-14 09:06:16 UTC
Responsible-Changed-From-To: unassigned->lerdsuwa
Responsible-Changed-Why: Patch in progress.
Comment 4 Kriang Lerdsuwanakij 2002-07-17 07:28:20 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in the main trunk (future GCC 3.3).
Comment 5 Kriang Lerdsuwanakij 2002-07-17 14:17:21 UTC
From: lerdsuwa@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/2862
Date: 17 Jul 2002 14:17:21 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	lerdsuwa@gcc.gnu.org	2002-07-17 07:17:21
 
 Modified files:
 	gcc/cp         : ChangeLog pt.c 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/template: instantiate2.C spec4.C 
 
 Log message:
 	PR c++/2862, c++/2863
 	* pt.c (determine_specialization): Compare the length of
 	TYPE_ARG_TYPES.  Tidy.
 	
 	* g++.dg/template/instantiate2.C: New test.
 	* g++.dg/template/spec4.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.2885&r2=1.2886
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.601&r2=1.602
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.1983&r2=1.1984
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/instantiate2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/spec4.C.diff?cvsroot=gcc&r1=NONE&r2=1.1