This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A simple sample code involving templates, friends and lookup
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Dragan Milenkovic" <dragan at plusplus dot co dot yu>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 17 Jan 2008 13:49:14 +0100
- Subject: Re: A simple sample code involving templates, friends and lookup
- References: <478F3175.2050809@plusplus.co.yu>
On Jan 17, 2008 11:44 AM, Dragan Milenkovic <dragan@plusplus.co.yu> wrote:
> Hello,
>
> I'm aware about these issues being around for quite a while now, but
> there is still a chance this sample code can be helpful. I apologize
> if someone gets annoyed :-P
>
>
> template <typename T>
> struct Foo
> {
> template <typename Z>
> friend void func(const Foo &);
> };
>
> void check(const Foo<int> & x)
> {
> // Foo<int> weird; // uncomment this line and all works
>
> func<int>(x); // <-- ERROR
> }
>
>
> Tested with gcc 4.0 - 4.3, and all behave the same:
>
> "error: 'func' was not declared in this scope"
>
> but it works if you uncomment the weird line.
Actually even with the weird line the program is invalid. What are
you trying to do? ;)
Richard.