c++/9122: qualified name forced to be used in non-public derived class

ZhenYu Hou hou_zhenyu@hotmail.com
Fri Jan 3 01:18:00 GMT 2003


Dear Neil

Sorry to bother you. But I still believe c++/9122 is a bug as the "p" in 
class "C" is not an access to the base of "C", but a newly defined pointer. 
Please see below:

class A {};
class B : A {
A* pp; // not full qualified, OK!
};
class C : public B {
public:
  C(A*);// compiler : `class A' is inaccessible
  void f(A*) {} compiler : `class A' is inaccessible
  A* p; // compiler : `class A' is inaccessible
  ::A* p2; // full qualified, OK!
};

I compiled the code with gcc2.95.3, VC7, BC5.5.1, all passed. And I looked 
up the C++ standard but have not found anything that forbid the sample code 
to compile.

Another point is if "A" in the sample was replace by "::A", all passed, it 
seems strange.

Best regards,

HouZhenyu


>From: neil@gcc.gnu.org
>Reply-To: neil@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,  
>hou_zhenyu@hotmail.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
>To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, hou_zhenyu@hotmail.com,  
>nobody@gcc.gnu.org
>Subject: Re: c++/9122: qualified name forced to be used in non-public 
>derived class
>Date: 2 Jan 2003 05:00:08 -0000
>
>Synopsis: qualified name forced to be used in non-public derived class
>
>State-Changed-From-To: open->closed
>State-Changed-By: neil
>State-Changed-When: Wed Jan  1 21:00:08 2003
>State-Changed-Why:
>     Not a bug.  You're using private inheritance.
>
>http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9122


_________________________________________________________________
MSN 8: advanced junk mail protection and 2 months FREE*. 
http://join.msn.com/?page=features/junkmail



More information about the Gcc-bugs mailing list