public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: gcc@gcc.gnu.org
Subject: Re: C++ language lawyer question
Date: Wed, 10 Mar 2004 08:05:00 -0000	[thread overview]
Message-ID: <m3llm9xhjb.fsf@uniton.integrable-solutions.net> (raw)
In-Reply-To: <20040310044725.GA7380@spuckler.il.thewrittenword.com>

Albert Chin <gcc@lists.thewrittenword.com> writes:

| In the process of compiling KDE 3.2 on IRIX 6.5 and Tru64 UNIX 5.1
| with the respective vendor C++ compilers, I ran into a namespace
| issue. Consider the following:

This is really a question for comp.lang.c++.moderated or comp.std.c++.

| $ cat a.h
| class KMAcctImap;
| 
| namespace KIO {
|   class Job {
|   public:
|     int b;
|   };
| }
| 
| namespace KMail {
|   class ImapJob {
|     friend class KMAcctImap;

In a friend declaration like that, if the thingy being given a
friendship is unqualified, then either there is a matching declaration
in the enclosing scope or it is considered invisibly declared in the 
innermost enclosing namespace.  So KMAcctImap is invisibly declared in
KMail::.  So despite appearance, you're not saying that ::KMAcctImap is 
friend of KMail::ImapJob.  If a compiler does not understand that,
then it has a bug in that area (that is the only point that makes your
posting relevant here because GCC does not get it right :-().

[...]

| I can cause a successful compile by changing:
|   namespace KMail {
|     class ImapJob {
|       friend class KMAcctImap;
| to:
|   namespace KMail {
|     class ImapJob {
|       friend class ::KMAcctImap;
|                    ^^
| 
| So, who is right and why?

See above.

-- Gaby

  reply	other threads:[~2004-03-10  8:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-10  4:47 Albert Chin
2004-03-10  8:05 ` Gabriel Dos Reis [this message]
2004-03-15  9:54 ` Nathan Sidwell
2004-03-15 10:19   ` Gabriel Dos Reis
  -- strict thread matches above, loose matches on Subject: below --
2004-02-10 19:34 C++ Language Lawyer Question Joel Sherrill
2004-02-10 19:40 ` Eric Christopher
2004-02-10 19:43 ` Giovanni Bajo
2004-02-10 20:11   ` Gabriel Dos Reis
2004-02-10 20:09 ` Gabriel Dos Reis
2004-02-10 20:39   ` Joel Sherrill
2003-09-29 23:21 C++ language lawyer question Gerald Pfeifer
2003-09-29 23:29 ` Bruce Stephens
2003-09-29 23:46 ` Mike Stump
2003-09-30  0:42   ` Gerald Pfeifer
2003-09-30  1:17     ` Bruce Stephens
2003-09-30  2:15       ` Mike Stump
2003-09-30  9:52     ` Gabriel Dos Reis
2003-10-02 21:02       ` Gerald Pfeifer
2003-09-30  9:18 ` Gabriel Dos Reis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3llm9xhjb.fsf@uniton.integrable-solutions.net \
    --to=gdr@integrable-solutions.net \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).