From 3816343447565320540
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8a1040c5e2aa56da
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-10-04 02:05:47 PST
Path: archiver1.google.com!news2.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: velco@fadata.bg (Momchil Velikov)
Newsgroups: comp.std.c++
Subject: Re: Is this a Bug in Comeau? (aka befriending classes in anonymous namespaces)
Date: Sat, 4 Oct 2003 09:05:45 +0000 (UTC)
Organization: http://groups.google.com
Lines: 42
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <87bded37.0310040043.877bae3@posting.google.com>
References: <sf79d3e6.083@kumc-smtpout.kumc.edu> <4fb4137d.0310010935.542ed05a@posting.google.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: mail2news.demon.co.uk 1065258345 26383 10.0.0.1 (4 Oct 2003 09:05:45 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Sat, 4 Oct 2003 09:05:45 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.12)
	id 1A5iMC-0006rO-00
	for mail2news@news.news.demon.net; Sat, 04 Oct 2003 09:05:44 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id TAA04599; Sat, 4 Oct 2003 19:05:40 +1000 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ucar.edu
X-Newsgroups: comp.std.c++
X-NNTP-Posting-Date: Sat, 4 Oct 2003 08:43:03 +0000 (UTC)
X-Spamscanner: mailbox1.ucsd.edu  (v1.2 May 26 2003 01:55:38, -1.0/5.0 2.55)
X-MailScanner: PASSED (v1.2.8 84941 h948h6E8089920 mailbox1.ucsd.edu)
X-Spam-Status: No, hits=-5.1 required=5.0
	tests=BAYES_10,QUOTED_EMAIL_TEXT,REFERENCES
	version=2.55
X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)
Xref: archiver1.google.com comp.std.c++:33

johnchx2@yahoo.com (johnchx) wrote in message news:<4fb4137d.0310010935.542ed05a@posting.google.com>...
> fvali@kumc.edu ("Faisal Vali") wrote 
> 
> > The following did not work either (trying to use Qualified Name lookup
> > to prevent the auto-declaration 'feature' of friend declarations)
> 
> This seems to be a common confusion.  There is no "auto-declaration
> 'feature'" and you can't disable it.  A friend declaration *is* a
> declaration, always and everywhere.  Put another way, the name
> declared as a friend is never "looked up," it is simply declared.
> 
> So the problem with this code ...
> 
>   namespace { class M; }
> 
>   class RD { friend class M; typedef int Q; };
> 
>   namespace { class M { RD::Q i; }; }
> 
> is that the friend declaration introduces a new class named M, and
> there's no way rewrite the friend declaration to explicitly refer to
> <unnamed>::M because <unnamed> is...well...unnamed.

Doesn't make sense.  A "friend" declaration is a friend declaration,
not class declaration. It does not introduce a new class, it refers
to a class specified by 1ISO/IEC 14882:1998(E) 11.4 "Friends"

   "7   A name nominated by a friend declaration shall be accessible in
        the scope of the class containing the friend declaration."

Thus in the above example "friend class M", refers to a class accessible at
namespace scope, and according to the definition of unnamed namespaces this
class is <unnamed>::M.  

~velco

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



