From 0e1dc7936418f0514f9cc7bbba3f71155236403b Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sun, 23 Jul 2023 13:34:34 +0800 Subject: [PATCH 1/3] [class.access.base] No cv-qualification for access checking --- source/classes.tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 39c538ecbd..6b3c1bd5c7 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -4765,10 +4765,10 @@ ``\tcode{this->}'', is used to access a non-static data member or non-static member function, the reference is ill-formed if the -left operand (considered as a pointer in the +left operand is of type \cv{}~\tcode{D*} (or \cv{}~\tcode{D} in the ``\tcode{.}'' -operator case) cannot be implicitly converted to a -pointer to the naming class of the right operand. +operator case), the naming class of the right operand is \cv{}~\tcode{B}, +and a prvalue of type \tcode{D*} cannot be implicitly converted to \tcode{B*}. \begin{note} This requirement is in addition to the requirement that the member be accessible as named. From 3dc80685fb414625f4165c51376e36652532f53c Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sun, 30 Jul 2023 02:03:36 +0800 Subject: [PATCH 2/3] [class.access.base] Use "pointer to cv D/B" --- source/classes.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 6b3c1bd5c7..74647dc716 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -4765,10 +4765,10 @@ ``\tcode{this->}'', is used to access a non-static data member or non-static member function, the reference is ill-formed if the -left operand is of type \cv{}~\tcode{D*} (or \cv{}~\tcode{D} in the -``\tcode{.}'' -operator case), the naming class of the right operand is \cv{}~\tcode{B}, -and a prvalue of type \tcode{D*} cannot be implicitly converted to \tcode{B*}. +left operand is of type ``pointer to \cv{}~\tcode{D}'' (or \cv{}~\tcode{D} +in the ``\tcode{.}'' operator case), the naming class of the right operand is +\cv{}~\tcode{B}, and a prvalue of type ``pointer to \tcode{D}'' cannot be +implicitly converted to ``pointer to \tcode{B}''. \begin{note} This requirement is in addition to the requirement that the member be accessible as named. From d315b8baf5acc0406841c4c3bf0208a14a2ddc52 Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Sun, 30 Jul 2023 23:13:11 +0800 Subject: [PATCH 3/3] [expr.ref] [class.access.base] Move the requirements --- source/classes.tex | 14 -------------- source/expressions.tex | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/source/classes.tex b/source/classes.tex index 74647dc716..45ee844889 100644 --- a/source/classes.tex +++ b/source/classes.tex @@ -4760,20 +4760,6 @@ \end{example} \end{itemize} -\pnum -If a class member access operator, including an implicit -``\tcode{this->}'', -is used to access a non-static data member or non-static -member function, the reference is ill-formed if the -left operand is of type ``pointer to \cv{}~\tcode{D}'' (or \cv{}~\tcode{D} -in the ``\tcode{.}'' operator case), the naming class of the right operand is -\cv{}~\tcode{B}, and a prvalue of type ``pointer to \tcode{D}'' cannot be -implicitly converted to ``pointer to \tcode{B}''. -\begin{note} -This requirement is in addition to the requirement that -the member be accessible as named. -\end{note} - \rSec2[class.friend]{Friends}% \indextext{friend function!access and}% \indextext{access control!friend function} diff --git a/source/expressions.tex b/source/expressions.tex index 480516076a..b23f9d809c 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -3636,14 +3636,24 @@ whose value is the value of the enumerator. \end{itemize} +\pnum +If \tcode{E1} is of type \cv~\tcode{D} and the naming +class\iref{class.access.base} of \tcode{E2} is \cv~\tcode{B}, the program is +ill-formed if a prvalue of type ``pointer to \tcode{D}'' cannot be +implicitly converted to ``pointer to \tcode{B}''. +\begin{note} +This requirement is in addition to the requirement that +the member be accessible as named. +\end{note} + \pnum If \tcode{E2} is a non-static member, the program is ill-formed if the class of which \tcode{E2} is directly a member is an ambiguous base\iref{class.member.lookup} of -the naming class\iref{class.access.base} of \tcode{E2}. +the naming class of \tcode{E2}. \begin{note} The program is also ill-formed if the naming class is an ambiguous base of the class type -of the object expression; see~\ref{class.access.base}. +of the object expression. \end{note} \pnum