C++ language lawyer question
Gerald Pfeifer
gerald@pfeifer.com
Tue Sep 30 00:42:00 GMT 2003
On Mon, 29 Sep 2003, Mike Stump wrote:
> Naw, this is an intro to C++ question.
Well, GCC up to and including GCC 3.3 gets it wrong ;-) -- that's why
I wondered when encountering this problem in a third-party application
(TaskJuggler).
> Yes, it is correct. A friend can't claim friendship, the person
> bestowing friendship must make the claim.
...and if the "invited" friend is a member of a class, it must not be
private or protected. This is the difference between GCC 3.3 and 3.4.
How about the doc patch below? (It may be a bit too oversimplified...)
Gerald
Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-3.4/changes.html,v
retrieving revision 1.49
diff -u -3 -p -r1.49 changes.html
--- changes.html 29 Sep 2003 17:53:08 -0000 1.49
+++ changes.html 29 Sep 2003 23:17:49 -0000
@@ -176,7 +176,12 @@
<pre>
template <typename T>
void f(T);</pre></li>
-
+
+ <li>In case of friend declarations that refer to members of a class,
+ these members need to be <code>public</code>, whereas G++ used to
+ accept <code>private</code>/<code>protected</code> members as well.
+ </li>
+
<li>You must use <code>template <></code> to introduce template
specializations, as required by the standard. For example,
<pre>
More information about the Gcc
mailing list