Skip to content

[class.access] Eliminate the friend case for protected member access from derived class #3672

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -4472,8 +4472,8 @@
\indextext{access control!\idxcode{protected}}%
protected;
that is, its name can be used only by members and friends
of the class in which it is declared, by classes derived from that class, and by their
friends (see~\ref{class.protected}).
of the class in which it is declared, and members of classes derived from that class
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"... and by members of classes derived..." (add "by" to keep the sentence structure manageable)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more concern here: We change "by classes" to "by members of classes". This change seems to exclude the base-specifier, which is not in a member. Example:

struct B { };
struct D1 : protected B { };
struct D2 : D1 {};

I think the injected-class-name B is protected in D1, thus accessible from D2. But the name doesn't appear in a member.

That said, this paragraph is just one of those intro sentences where the actual rules appear later. (Note the funny punctuation, btw.) So, we shouldn't say wrong things, but we don't need to be ultra-precise either.

(see~\ref{class.protected}).
\item
\indextext{access control!\idxcode{public}}%
public;
Expand Down