Bug 11546 - [3.3 Regression] Type lookup problems in out-of-line definition of a class doubly nested from a template class
Summary: [3.3 Regression] Type lookup problems in out-of-line definition of a class do...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P2 normal
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
URL:
Keywords: monitored, rejects-valid
: 10749 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-16 13:08 UTC by Benjamin S. Scarlet
Modified: 2003-07-22 18:32 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2003-07-16 13:14:43


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin S. Scarlet 2003-07-16 13:08:39 UTC
The following code does not compile as expected:

template <class T0>
class A {
public:
  class B;
};

template <class T0>
class A<T0>::B {
public:
  class C;
};

template <class T0>
class A<T0>::B::C {
public:
  A<T0> &a;
};

I originally tried with the redhat 9 gcc-3.2, which ICE'd. I then followed up by
downloading and compiling vanilla gcc-3.3 from ftp.gnu.org. With the g++ from
that compile, the above code produces:

Foo.cpp:16: error: non-template type `A' used as a template
Foo.cpp:16: error: ISO C++ forbids declaration of `a' with no type

Since A most definitely is a template, I think this is wrong. I've seen other
weird behaviour with more complex examples, but this seems like a good starting
point.
Comment 1 Andrew Pinski 2003-07-16 13:14:43 UTC
I can confirm this on 3.3.1 (20030707) but on the mainline (20030715) it is already fixed.  3.0.4 
accepted the code while 3.2.3 ICEd on it.  Could someone test a later version of 3.3.1?
Comment 2 CVS Commits 2003-07-20 04:49:08 UTC
Subject: Bug 11546

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	mmitchel@gcc.gnu.org	2003-07-20 04:49:03

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

Log message:
	PR c++/11546
	* pt.c (lookup_template_class): Treat TYPE_DECLs as TEMPLATE_DECLs
	where appropriate.
	
	PR c++/11546
	* testsuite/g++.dg/template/lookup1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.184&r2=1.3076.2.185
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.635.2.34&r2=1.635.2.35
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.237&r2=1.2261.2.238
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/lookup1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1

Comment 3 CVS Commits 2003-07-20 04:52:25 UTC
Subject: Bug 11546

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2003-07-20 04:52:23

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/template: lookup1.C 

Log message:
	PR c++/11546
	* g++.dg/template/lookup1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2900&r2=1.2901
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/lookup1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2

Comment 4 Mark Mitchell 2003-07-20 04:54:33 UTC
Fixed in GCC 3.3.1.
Comment 5 Mark Mitchell 2003-07-20 04:56:25 UTC
Fixed in GCC 3.3.1.
Comment 6 Mark Mitchell 2003-07-22 18:32:09 UTC
*** Bug 10749 has been marked as a duplicate of this bug. ***