From 7375212001274775147
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,b5c0527fadfb5f46,start
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,b5c0527fadfb5f46,start
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-12-01 16:05:10 PST
Xref: sparky comp.lang.c++:17235 comp.std.c++:1657
Newsgroups: comp.lang.c++,comp.std.c++
Path: sparky!uunet!gatech!darwin.sura.net!wupost!usc!news.service.uci.edu!network.ucsd.edu!qualcom.qualcomm.com!qualcom.qualcomm.com!greg
From: greg@qualcom.qualcomm.com (Greg Noel)
Subject: Is this legal C++?
Message-ID: <1992Dec1.234709.5823@qualcomm.com>
Followup-To: comp.lang.c++
Sender: news@qualcomm.com
Nntp-Posting-Host: qualcom.qualcomm.com
Organization: Qualcomm, Inc., San Diego, CA
Date: Tue, 1 Dec 1992 23:47:09 GMT
Lines: 28

This came up as part of an internal discussion and we can't seem to resolve
it here.  Is this code fragment legal C++?

	template <class T>
	class Bar
	{
		friend class T;
		class T *t = 0;
	};

	class Foo : public Bar<Foo>
	{
		friend class Bar<Foo>;
		class Foo *f;
	};

Now, I'm not going to argue that this is good programming practice, but
that's a different topic.  The question on the floor is if this is _legal_,
not whether it's stylisticly reasonable.

Incidentally, G++ accepts this without any problems, and seems to do
what I expect it to do.

Note that followups are directed to comp.lang.c++.

Tks,
-- 
-- Greg Noel, Unix Guru         greg@qualcomm.com  or  greg@noel.cts.com


