Bug 15025 - [3.4/4.0 Regression] accepts redeclaration of template as non-template
Summary: [3.4/4.0 Regression] accepts redeclaration of template as non-template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 3.4.1
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
: 15024 (view as bug list)
Depends on:
Blocks: 15024
  Show dependency treegraph
 
Reported: 2004-04-20 12:02 UTC by Andrew Pinski
Modified: 2004-10-30 21:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 3.2.3 3.3.4 3.3.3
Known to fail: 3.4.0 4.0.0
Last reconfirmed: 2004-04-20 12:54:42


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-04-20 12:02:44 UTC
I came up with this reducing PR 15024:
template<typename> struct CartesianURM;
template<typename a> struct B
{
  typedef CartesianURM<a> F;
};
template <typename c> struct G : public B<c>::F
{
};
struct CartesianURM {};
G<int> f();
Comment 1 Wolfgang Bangerth 2004-04-20 12:54:41 UTC
Indeed, a regression on 3.4 and mainline w.r.t. 3.3 and previous versions. 
The code is definitely invalid. This is the shortest I can get: 
---------- 
template <int> struct X; 
struct X {}; 
---------- 
 
W. 
Comment 2 GCC Commits 2004-05-23 21:02:43 UTC
Subject: Bug 15025

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-05-23 21:02:18

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog decl.c 
Added files:
	gcc/testsuite/g++.dg/template: redecl1.C 

Log message:
	PR c++/15025
	* decl.c (xref_tag): Issue errors about redeclaring template
	classes as non-template classes.
	
	PR c++/15025
	* g++.dg/template/redecl1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.180&r2=1.3389.2.181
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.103&r2=1.3892.2.104
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1174.2.19&r2=1.1174.2.20
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/redecl1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 3 Mark Mitchell 2004-05-23 21:06:22 UTC
*** Bug 15024 has been marked as a duplicate of this bug. ***
Comment 4 GCC Commits 2004-05-23 21:07:12 UTC
Subject: Bug 15025

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-23 21:07:00

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog decl.c 
Added files:
	gcc/testsuite/g++.dg/template: redecl1.C 

Log message:
	PR c++/15025
	* decl.c (xref_tag): Issue errors about redeclaring template
	classes as non-template classes.
	
	PR c++/15025
	* g++.dg/template/redecl1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3774&r2=1.3775
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/redecl1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4054&r2=1.4055
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1209&r2=1.1210

Comment 5 Mark Mitchell 2004-05-23 21:08:22 UTC
Fixed in GCC 3.4.1.