Skip to content

Commit 14f03aa

Browse files
eisenwavetkoeppe
authored andcommitted
CWG3093 Missing integration of direct base class relationships
Fixes NB US 27-059 (C++26 CD).
1 parent 7dca467 commit 14f03aa

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

source/basic.tex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,9 @@
405405
an array operand, the set contains the potential results of that operand.
406406
\item If $E$ is a class member access
407407
expression\iref{expr.ref} of the form
408-
$E_1$ \tcode{.} \opt{\keyword{template}} $E_2$
409-
naming a non-static data member,
408+
$E_1$ \tcode{.} \opt{\keyword{template}} $E_2$,
409+
where $E_2$ designates a a non-static data member or
410+
a direct base class relationship,
410411
the set contains the potential results of $E_1$.
411412
\item If $E$ is a class member access expression
412413
naming a static data member,

source/expressions.tex

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@
147147
\end{importgraphic}
148148

149149
\begin{itemize}
150-
\item A \defn{glvalue} is an expression whose evaluation determines the identity of an object, function, or non-static data member.
150+
\item A \defn{glvalue} is an expression
151+
whose evaluation determines the identity of
152+
an object, function, non-static data member, or
153+
a direct base class relationship.
151154
\item A \defn{prvalue} is an expression whose evaluation initializes an object
152155
or computes the value of an operand of an operator,
153156
as specified by the context in which it appears,
@@ -1487,6 +1490,10 @@
14871490
\end{example}
14881491
\end{itemize}
14891492

1493+
\pnum
1494+
A \grammarterm{splice-expression} that designates a direct base class relationship
1495+
shall appear only as the second operand of a class member access.
1496+
14901497
\pnum
14911498
For an \grammarterm{id-expression} that denotes an overload set,
14921499
overload resolution is performed
@@ -3598,6 +3605,10 @@
35983605
does not apply to a \grammarterm{splice-expression}.
35993606
\end{note}
36003607
\item
3608+
Otherwise, if $S$ is a direct base class relationship $(\tcode{D}, \tcode{B})$,
3609+
the expression is an lvalue designating $S$.
3610+
The expression has the type \tcode{B}.
3611+
\item
36013612
Otherwise, if $S$ is a variable or a structured binding,
36023613
$S$ shall either have static or thread storage duration or
36033614
shall inhabit a scope enclosing the expression.
@@ -4362,7 +4373,8 @@
43624373

43634374
\pnum
43644375
If \tcode{E2} designates a non-static member
4365-
(possibly after overload resolution) and
4376+
(possibly after overload resolution)
4377+
or direct base class relationship and
43664378
the result of \tcode{E1} is an object whose type
43674379
is not similar\iref{conv.qual} to the type of \tcode{E1},
43684380
the behavior is undefined.

source/overloading.tex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3693,6 +3693,15 @@
36933693
\begin{ncsimplebnf}
36943694
\terminal{(} postfix-expression . \keyword{operator} \terminal{->} \terminal{(}\terminal{)} \terminal{)} \terminal{->} \opt{\keyword{template}} id-expression
36953695
\end{ncsimplebnf}
3696+
Analogously, for an expression of the form
3697+
\begin{ncsimplebnf}
3698+
postfix-expression \terminal{->} splice-expression
3699+
\end{ncsimplebnf}
3700+
the operator function is selected by overload resolution,
3701+
and the expression is interpreted as
3702+
\begin{ncsimplebnf}
3703+
\terminal{(} postfix-expression . \keyword{operator} \terminal{->} \terminal{(}\terminal{)} \terminal{)} \terminal{->} splice-expression
3704+
\end{ncsimplebnf}
36963705

36973706
\rSec2[over.inc]{Increment and decrement}
36983707
\indextext{increment operator!overloaded|see{overloading, increment operator}}%

source/templates.tex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5874,9 +5874,15 @@
58745874
\pnum
58755875
A class member access expression\iref{expr.ref} is
58765876
type-dependent if
5877-
the terminal name of its \grammarterm{id-expression}, if any, is dependent or
5877+
\begin{itemize}
5878+
\item
5879+
the terminal name of its \grammarterm{id-expression}, if any, is dependent,
5880+
\item
5881+
its \grammarterm{splice-expression}, if any, is type-dependent, or
5882+
\item
58785883
the expression refers to a member of the current instantiation and
58795884
the type of the referenced member is dependent.
5885+
\end{itemize}
58805886
\begin{note}
58815887
In an expression of the form
58825888
\tcode{x.y}

0 commit comments

Comments
 (0)