Copy constructor revisited

Nathan Sidwell nathan@codesourcery.com
Thu Apr 22 15:31:00 GMT 2004


Robert Schweikert wrote:
> I have another question about the copy ctor accessibility requirement
> and the changes in 3.4.
> 
> I pretty much understand the requirements and interpretation of the
> Standard w.r.t. private copy ctor usage. As it pertains to the example
> on http://gcc.gnu.org/gcc-3.4/changes.html
> 
> However, what happens with a protected copy ctor and access of that ctor
> by its derived class?

> B can access the copy ctor of A since it is protected and not private
> and B is a derived class of A.
Only for those A's that are bases of the B' member's this pointer.

> Yet trying to compile this code yields an
> error:
because it is for a copy of not-a-base-of-a-B

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk




More information about the Gcc mailing list