-
Notifications
You must be signed in to change notification settings - Fork 1
CWG1699 Does befriending a class befriend its friends? #1573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
EWG Discussed this on Monday in Varna, and the following poll was taken: EWG agrees with the 'first' CWG proposed solution from the November '21 rationale on CWG 1699, that friend functions defined in a class get access to the private/protected members of the class, however friend functions NOT defined in the class definition do not.
However, further discussion lead to further explanation of the inconsistencies, and EWG determined that a paper (written by @jfbastien, Jeff Snyder, et al) explaining the following examples should be presented later in the week:
Sad paper is encouraged to consider templates (class template, function template, and member function templates), as well as modules. |
Note that there's a similar issue that is usually considered to be part of CWG1699: if
It would be good if the paper would also discuss this case. |
The discussion included a request to discuss templates in modules as well. |
EWG St. Louis: @villevoutilainen volunteered to write a paper. |
A friend declaration is a member-declaration, but it is not clear how far the granting of friendship goes in a friend declaration. For example:
In particular, if a friend function is defined inside the class definition, as in #3, does its definition have access to the private and protected members of the befriending class? Implementations vary on this point.
See CWG1699 for the full discussion.
The text was updated successfully, but these errors were encountered: