From 6820938209903260321
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,72f81acd9a4d6dd0,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,72f81acd9a4d6dd0,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1995-02-22 09:58:03 PST
Newsgroups: comp.std.c++,comp.lang.c++
Path: nntp.gmd.de!stern.fokus.gmd.de!ceres.fokus.gmd.de!zib-berlin.de!news.mathworks.com!news.alpha.net!uwm.edu!fnnews.fnal.gov!unixhub!courant.SLAC.Stanford.EDU!alhy
From: alhy@courant.SLAC.Stanford.EDU (J. Scott Berg)
Subject: Forward declaration of classes nested in template classes
Message-ID: <D4Exwr.34B@unixhub.SLAC.Stanford.EDU>
Keywords: nested template forward
Sender: news@unixhub.SLAC.Stanford.EDU
Organization: Stanford Linear Accelerator Center
Date: Wed, 22 Feb 1995 17:58:03 GMT
Lines: 25
Xref: nntp.gmd.de comp.std.c++:11608 comp.lang.c++:91484

Consider the following declaration:

template<class T> class A { class B; };
template<class T> class A<T>::B { A<T> a; };

As far as I can tell from the 9/20/94 WP, this is illegal (my
compilers seem to agree with me on this, unless I have the syntax
wrong).  Yet, if A were not a template class, the construct would be
legal; i.e.,

class A { class B; };
class A::B { A a; };

Am I right in thinking that the template version is illegal?  If so,
is there a reason that the template version is illegal?  If not, I
would suggest that the ANSI/ISO folks might want to allow such a
forward declaration.

Thanks

				-Scott Berg
-- 
J. Scott Berg       Real mail: Varian Physics; Stanford  CA  94305-4060
email: ALHY@slac.stanford.edu
phone:	(415) 926-4732 (w)  (415) 854-2713 (h)


