[cfe-dev] Beginnings of C++ access control (and question about standard)

Tim Northover T.P.Northover at sms.ed.ac.uk
Sun Apr 26 05:43:37 PDT 2009


On Sunday 26 Apr 2009 13:00:10 Sebastian Redl wrote:
> Sorry for taking so long to respond.

No worries, I appreciate the effort.

> So, it makes sense. I think the justification from the standard point of
> view is in this sentence fragment: "where m as a member of P is public,
> private, or protected". n.m (or o.m) here is not a member of P. If n was
> a reference to N, then it could perhaps be one, but we can't prove it.
> So it makes no sense to speak of m as a member of P, so the condition is
> false.

I think the separate(ish) section Daniel pointed out ([class.protected]) takes 
care of it nicely. There are four cases for "m as a member of N":
public: no problem
private: enclosing scope has to /be/ N, so no problem.
protected: [class.protected] demands the sensible check.
none: effectively becomes a question of whether we can cast some objects to 
make things work. Reduces to one of the above cases.

You seem to be suggesting it's a reasonably well-known issue, so perhaps 
that's a new addition (I don't actually have C++98 itself, just one of the 
drafts for a later version) to clarify things.

> I'll look at the patch in your later post.

Thanks again for the time.

Tim.




More information about the cfe-dev mailing list