This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: template parameters cannot be friends
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: llewelly at xmission dot com
- Cc: "naje" <najeiv at ukr dot net>, gcc-help at gcc dot gnu dot org
- Date: 21 May 2004 16:57:13 +0200
- Subject: Re: template parameters cannot be friends
- Organization: Integrable Solutions
- References: <E1BR9A8-000LP6-00@storage.ukr.net><s3rad0124xu.fsf@xmission.xmission.com>
llewelly@xmission.com writes:
| "naje" <najeiv@ukr.net> writes:
|
| > Hello,
| > would you suggest to me, why gcc 3.3.3 can not compile this:
| >
| > template<class T>
| > class Base
| > {
| > friend T;
|
| typedefs and template parameters are not allowed to be friends. 14.5.3
| describes the constructs allowed in a friend declaration in a
| class template, and typedefs and template parameters are not
| amoung them.
|
| I think this is unfortunate, but it's rare to need this feature.
Yes, hopefully that restriction will be removed from future versions of
C++.
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2003/n1520.pdf
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2004/n1616.pdf
-- Gaby