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

Sebastian Redl sebastian.redl at getdesigned.at
Sun Apr 26 05:38:53 PDT 2009


Sebastian Redl wrote:
> 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.
>
> Not a very good justification, I have to admit. You should ask on
> comp.std.c++ for clarification.
>   
OK, actually I've found what we were looking for. The test case is
actually forbidden by 11.5p1 [class.protected]. It details access to
protected members. In particular, this:

"All other accesses involve a (possibly implicit) object expression. In
this case, the class of the object expression shall be C or a class
derived from C."
where C is the class in which the access occurs.

Sebastian



More information about the cfe-dev mailing list