This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 2.95.2 can't handle dependent friend member functions
- To: sebor at my-Deja dot com
- Subject: Re: g++ 2.95.2 can't handle dependent friend member functions
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Sun, 5 Mar 2000 13:03:39 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <LGKPIJCIBKKBNAAA@my-deja.com>
> the program below doesn't compile with g++ 2.95.2. I can't find anything
> in 11.4 or in 14.5.3 that would indicate that the code is not legal. It
> compiles fine with edg 2.42. Am I missing something or is this a g++
> bug?
I'm not sure. In 8/4, a declarator is defined as (among other options)
direct苓eclarator:
declarator虹d
...
declarator虹d:
id苟xpression
...
In 5.1, this is defined as
id苟xpression:
unqualified虹d
qualified虹d
qualified虹d:
::opt nested要ame貞pecifier template-opt unqualified虹d
nested要ame貞pecifier:
class觔r要amespace要ame :: nested要ame貞pecifier-opt
class觔r要amespace要ame :: template nested要ame貞pecifier
class觔r要amespace要ame:
class要ame
namespace要ame
So in a qualified id, you can only use class-names and
namespace-names. 14.1/3 says a type-parameter is a type-name; it does
not say it is a class-name. As a result, you cannot qualify a friend
with a template type parameter. This is consistent with the
restriction that you cannot declare a template parameter as a friend
(7.1.5.3/2)
Now, of course, following this interpretation has some interesting
consequences, so I suspect a Defect somewhere.
Regards,
Martin