c++/6372: private inheritance makes class totally inaccessible, even as parameter

Gwenole Beauchesne gbeauchesne@mandrakesoft.com
Fri Apr 19 10:45:00 GMT 2002


Hi,

> class A { };
> class B : private A { };
> class C : public B {
> public:
>     C(A*){}
> };

This looks inccorect according to 11.1 [#3] + DR #175.

<--- part of DR 175 --->
Proposed resolution (04/01):

Add to the end of 11.1  class.access.spec paragraph 3:

[Note: In a derived class, the lookup of a base class name will find the 
injected-class-name instead of the name of the base class in the scope in 
which it was declared. The injected-class-name might be less accessible 
than the name of the base class in the scope in which it was declared.] 
[Example:

class A { };
    class B : private A { };
    class C : public B {
        A* p;    // error: injected-class-name A is inaccessible
        ::A* q;  // OK
    };

--end example]

What do you think Gaby?




More information about the Gcc-bugs mailing list