public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: dbaron@fas.harvard.edu To: gcc-gnats@gcc.gnu.org Subject: c++/8280: friend declaration introduces class name into namespace scope Date: Fri, 18 Oct 2002 16:56:00 -0000 [thread overview] Message-ID: <20021018234833.19757.qmail@sources.redhat.com> (raw) >Number: 8280 >Category: c++ >Synopsis: friend declaration introduces class name into namespace scope >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: accepts-illegal >Submitter-Id: net >Arrival-Date: Fri Oct 18 16:56:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: dbaron@fas.harvard.edu >Release: 3.2 >Organization: >Environment: Configured with: ../gcc-3.2/configure --prefix=/usr/local/gcc-3.2 --enable-languages=c++ --enable-__cxa_atexit Thread model: posix gcc version 3.2 (on Linux 2.4.18-17.8.0smp i686, i.e., RedHat 8.0) Also present on gcc trunk: gcc version 3.3 20021007 (experimental) >Description: According to section 7.3.1.2, clause 3, of the C++ standard: If a |friend| declaration in a non-local class first declares a class or function the friend class or function is a member of the innermost enclosing namespace. The name of the friend is not found by simple name lookup until a matching declaration is provided in that namespace scope (either before or after then class declaration granting friendship). In other words (I think), |friend class B| is allowed even if B hasn't been declared yet, but it doesn't declare B. I have been told that this was not true in older drafts of the standard. >How-To-Repeat: The following source code is sufficient to reproduce the problem: ----- class A { friend class B; }; // The name |B| should not be found yet, so this // should not compile. B* null_b() { return 0; } int main() { return 0; } ----- Compile with: g++ -o friend -ansi -pedantic test.cpp >Fix: >Release-Note: >Audit-Trail: >Unformatted:
reply other threads:[~2002-10-18 23:56 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20021018234833.19757.qmail@sources.redhat.com \ --to=dbaron@fas.harvard.edu \ --cc=gcc-gnats@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: linkBe 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).