This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ language lawyer question
- From: Gerald Pfeifer <gerald at pfeifer dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 30 Sep 2003 01:21:54 +0200 (CEST)
- Subject: Re: C++ language lawyer question
- References: <E23F868D-F2CF-11D7-8F0D-003065A77310@apple.com>
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>