This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20397] g++ rejects valid code with 'is inaccessible' error
- From: "drow at false dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Mar 2005 03:45:05 -0000
- Subject: [Bug c++/20397] g++ rejects valid code with 'is inaccessible' error
- References: <20050309212435.20397.matthew.whitney@gmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From drow at false dot org 2005-03-10 03:45 -------
Subject: Re: g++ rejects valid code with 'is inaccessible' error
On Thu, Mar 10, 2005 at 02:25:03AM -0000, matthew dot whitney at gmail dot com wrote:
> Now it compiles fine. Before this is closed again I'd like to understand why it
> should matter what type an unreferenced parameter is. Why shouldn't I be able to
> pass a pointer to an object of type A (completely unrelated to C) to one of C's
> methods? Thanks in advance.
You could if A were completely unrelated to C. You have C deriving
from B, and B deriving from A, which means that the name A binds to the
base class inside C; and the base class is inaccessible, so it may not
be referred to. As Andrew said, use ::A.
If you want chapter and verse from the C++ standard, I can't help you,
but I'm sure someone else here can.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20397