public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugzilla-gcc at thewrittenword dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/14513] New: namespace problem Date: Wed, 10 Mar 2004 15:42:00 -0000 [thread overview] Message-ID: <20040310154252.14513.bugzilla-gcc@thewrittenword.com> (raw) 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: $ cat a.h class KMAcctImap; namespace KIO { class Job { public: int b; }; } namespace KMail { class ImapJob { friend class KMAcctImap; public: ImapJob(); private: KIO::Job *mJob; }; } $ cat b.cpp namespace KIO { class Job; } namespace KMail { class ImapJob; } using KMail::ImapJob; class KMAcctImap { friend class KMail::ImapJob; public: void test (void); }; #include "a.h" void KMAcctImap::test (void) { ImapJob *f = new ImapJob (); if (f->mJob) int b; } Compile results with different compilers: (Solaris Sun One 8 compiler) $ CC -c b.cpp "b.cpp", line 22: Error: mJob is not accessible from KMAcctImap::test(). 1 Error(s) detected. (HP-UX C++ compiler) $ aCC -c b.cpp Error 182: "b.cpp", line 22 # "void KMAcctImap::test()" cannot access private member "KIO::Job *KMail::ImapJob::mJob". if (f->mJob) ^^^^^^^ (IRIX C++ compiler) $ CC -c b.cpp cc-1238 CC: ERROR File = b.cpp, Line = 22 The member "KMail::ImapJob::mJob" is inaccessible. if (f->mJob) ^ (IBM C++ compiler) $ xlC -c b.cpp [success] (Tru64 UNIX C++ compiler) $ cxx -c b.cpp cxx: Error: b.cpp, line 22: member "KMail::ImapJob::mJob" is inaccessible if (f->mJob) ---------^ (GCC 3.3.2 with some patches from 3.3.3 merged in) $ g++ -c b.cpp [success] I can cause a successful compile by changing: namespace KMail { class ImapJob { friend class KMAcctImap; to: namespace KMail { class ImapJob { friend class ::KMAcctImap; ^^ Based on http://gcc.gnu.org/ml/gcc/2004-03/msg00499.html, GCC is incorrect. -- Summary: namespace problem Product: gcc Version: 3.3.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bugzilla-gcc at thewrittenword dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14513
next reply other threads:[~2004-03-10 15:42 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-03-10 15:42 bugzilla-gcc at thewrittenword dot com [this message] 2004-03-10 15:53 ` [Bug c++/14513] " pinskia at gcc dot gnu dot org 2004-03-10 16:24 ` [Bug c++/14513] Friend name injection problem (implicit declaration) bangerth at dealii dot org 2004-03-10 19:55 ` gdr at integrable-solutions dot net 2004-08-12 0:58 ` pinskia at gcc dot gnu dot org 2004-09-04 12:47 ` lerdsuwa at gcc dot gnu dot org 2004-10-17 14:08 ` lerdsuwa at gcc dot gnu dot org 2004-11-12 17:03 ` lerdsuwa at gcc dot gnu dot org 2004-11-19 10:10 ` lerdsuwa at gcc dot gnu dot org 2004-11-25 16:55 ` cvs-commit at gcc dot gnu dot org 2004-11-25 17:05 ` lerdsuwa at gcc dot gnu dot org 2005-01-12 19:47 ` pinskia at gcc dot gnu dot org 2005-01-13 0:37 ` giovannibajo at libero dot it 2005-01-13 14:55 ` lerdsuwa 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=20040310154252.14513.bugzilla-gcc@thewrittenword.com \ --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).