What's this?
Robert L Krawitz
rlk@tiac.net
Sun Sep 20 09:25:00 GMT 1998
Cc: egcs-bugs@cygnus.com, smr@torrent.com, jcallen@torrent.com, rlk@rlk-ppp-1
From: Alexandre Oliva <oliva@dcc.unicamp.br>
Date: 20 Sep 1998 04:44:05 +-300
--Multipart_Sun_Sep_20_04:44:05_1998-1
Content-Type: text/plain; charset=US-ASCII
Robert L Krawitz <rlk@tiac.net> writes:
> bar.C:4: warning: friend declaration `class foo<T> bar(int, const class foo<T> &)'
> bar.C:4: warning: declares a non-template function
That wasn't what I was objecting to...
Here's a patch to the egcs FAQ for it to explain how to fix your code.
Jeff, ok to install?
+template <typename T>
+class foo {
+ friend void bar<>(foo<T>);
+};
The problem is that this doesn't work with a lot of compilers:
template<class T>
class foo
{
friend void bar<>(foo<T>);
};
This, however, does work reliably, at least with the compilers I have
at hand:
template<class T>
class foo
{
friend void bar<T>(foo<T>);
};
>From a standpoint of clarity and back compatibility, I believe that it
would be preferable to emphasize that the second form is equally legal
(it is, no?) and more compatible with older compilers.
--
Robert Krawitz <rlk@tiac.net> http://www.tiac.net/users/rlk/
Tall Clubs International -- http://www.tall.org/ or 1-888-IM-TALL-2
Member of the League for Programming Freedom -- mail lpf@uunet.uu.net
"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton
More information about the Gcc-bugs
mailing list