Created on 2014-02-18.00:00:00 last changed 94 months ago
[Moved to DR at the May, 2015 meeting.]
Proposed resolution, November, 2014:
Change bullet 5.3 of 11.8.3 [class.access.base] as follows:
...A member m is accessible at the point R when named in class N if
...
m as a member of N is protected, and R occurs in a member or friend of class N, or in a member
or friendof a class P derived from N, where m as a member of P is public, private, or protected, orthere exists...
Notes from the November, 2014 meeting:
Although the asymmetry is unfortunate, the difference between a reference in a member function and a reference in a friend is that the member function concretely determines which P is in view, while the friend could be befriended by a class that is a specialization of a class template and thus would require instantiations that would not otherwise occur. CWG thus decided simply to eliminate the friend case.
Notes from the June, 2014 meeting:
CWG noted that removing the friend provision would introduce an undesirable asymmetry between member functions of P and its friends. Instead, the intent is to require P to be a complete type at R.
According to 11.8.3 [class.access.base] paragraph 5,
A member m is accessible at the point R when named in class N if
...
m as a member of N is protected, and R occurs in a member or friend of class N, or in a member or friend of a class P derived from N, where m as a member of P is public, private, or protected, or
...
The granting of access via class P is troubling. At the least, there should be a restriction that P be visible at R. Alternatively, this portion of the rule could be removed altogether; this provision does not appear to be widely used in existing code and such references can be easily converted to use P instead of N for naming the member.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-11-10 00:00:00 | admin | set | status: dr -> drwp |
2015-05-25 00:00:00 | admin | set | messages: + msg6053 |
2015-05-25 00:00:00 | admin | set | status: ready -> dr |
2014-11-24 00:00:00 | admin | set | messages: + msg5154 |
2014-11-24 00:00:00 | admin | set | messages: + msg5153 |
2014-11-24 00:00:00 | admin | set | status: drafting -> ready |
2014-07-07 00:00:00 | admin | set | messages: + msg5092 |
2014-07-07 00:00:00 | admin | set | status: open -> drafting |
2014-02-18 00:00:00 | admin | create |