This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A simple sample code involving templates, friends and lookup


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]