This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ language lawyer question
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Gerald Pfeifer <gerald at pfeifer dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 30 Sep 2003 09:21:37 +0200
- Subject: Re: C++ language lawyer question
- Organization: Integrable Solutions
- References: <Pine.BSF.4.56.0309300039510.66215@acrux.dbai.tuwien.ac.at>
Gerald Pfeifer <gerald@pfeifer.com> writes:
| Current mainline issues the following error
|
| x.cc:2: error: `void A::a()' is private
| x.cc:6: error: within this context
|
| for this snippet:
|
| class A {
| void a();
| };
|
| class B {
| friend void A::a();
| };
|
| I'm not a language lawyer, but is this really correct? (Intuitively, it
| seems quite backwards.)
Gerald --
Despite what has been claimed about the simplicy of the issue, it is
not as clear cut some would like to believe. Exactly the issue you're
raising has been a subject of a DR, and although it has been decided
to resolve it as a NAD, it is highly instructive to read
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_closed.html#209
What is amusing is the rationale for resolving the issue as a NAD:
Ultimately it was decided that the original perceived defect was not
sufficiently serious as to warrant the degree of complexity required
to resolve it satisfactorily and the issue was consequently declared
not to be a defect. It was observed that most of the problems
involved with the current state of affairs result from inability to
declare a particular member function as a friend; in such cases, an
easy workaround is simply to befriend the entire class rather than
the specific member function.
I believe your addition to changes.html should include that link.
-- Gaby