public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dpiepgrass at mentoreng dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/32204] friend from global namespace in template class ignored Date: Mon, 26 Mar 2012 21:24:00 -0000 [thread overview] Message-ID: <bug-32204-4-1mGQJ7zhiV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-32204-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32204 David Piepgrass <dpiepgrass at mentoreng dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dpiepgrass at mentoreng dot | |com --- Comment #3 from David Piepgrass <dpiepgrass at mentoreng dot com> 2012-03-26 21:20:11 UTC --- I have run into this bug or a similar bug while porting my code from MSVC to GCC. I need to declare that a class in the global namespace is a friend of my template class. However, I discovered that the bug still occurs if no templates are involved. Here's my repro: class Friend; namespace Foo { class Base { }; class Derived : protected Base { friend class Friend; }; } class Friend { void F(const Foo::Derived* data) const { // error: 'Foo::Base' is an inaccessible base of 'Foo::Derived' const Foo::Base* dataB = data; } }; The problem disappears if either (A) Derived is not in a namespace, or (B) Friend is in a namespace (the forward declaration of Friend is required and, of course, must be put in the namespace too).
next prev parent reply other threads:[~2012-03-26 21:20 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-32204-4@http.gcc.gnu.org/bugzilla/> 2011-01-17 6:48 ` jag-gnu at jag dot dreamhost.com 2012-03-26 21:24 ` dpiepgrass at mentoreng dot com [this message] 2012-03-26 21:32 ` dpiepgrass at mentoreng dot com 2012-03-26 23:52 ` redi at gcc dot gnu.org 2012-03-27 0:44 ` redi at gcc dot gnu.org 2012-10-27 8:12 ` scottbaldwin at gmail dot com 2012-10-27 8:52 ` scottbaldwin at gmail dot com 2012-10-27 13:13 ` redi at gcc dot gnu.org 2012-10-27 13:39 ` scottbaldwin at gmail dot com 2007-06-04 12:01 [Bug c++/32204] New: " klaus dot kretschel at dlr dot de 2009-12-08 23:11 ` [Bug c++/32204] " redi at gcc dot gnu dot org
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=bug-32204-4-1mGQJ7zhiV@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).