[Bug c++/20397] g++ rejects valid code with 'is inaccessible' error

drow at false dot org gcc-bugzilla@gcc.gnu.org
Thu Mar 10 03:45:00 GMT 2005


------- 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



More information about the Gcc-bugs mailing list