A simple sample code involving templates, friends and lookup
Dragan Milenkovic
dragan@plusplus.co.yu
Fri Jan 18 14:17:00 GMT 2008
Jonathan Wakely wrote:
> On 17/01/2008, Richard Guenther wrote:
>> Well, a language lawyer can probably clear things up. From a look
>> at the std it looks like w/o a previous declaration the above should
>> be invalid. And at a different point it suggests the decl becomes
>> available.
>
> Yes, at the point of instantiation of Foo<int> the friend is declared,
> and can then be found by ADL because Foo<int> is an associated type.
> The reference parameter 'x' doesn't cause an instantiation, only 'weird' does.
>
> However, see the discussion in section 9.2.2 of Vandevoorde and
> Josuttis' C++ Templates book and the footnote saying the standard
> isn't exactly clear.
[snip]
Thanks for clarification and info. I believe issue #34 addresses exactly
what we're talking about.
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#34
Hey... the current number of issues is kinda scary... :-O
Dragan
More information about the Gcc
mailing list