Skip to content

Commit dbe0b33

Browse files
Dawn Perchikzygoloid
authored andcommitted
CWG1836 Use of class type being defined in trailing-return-type
1 parent 670db0b commit dbe0b33

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

source/expressions.tex

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,12 @@
376376
the declaration of a static member function (although its type and value category
377377
are defined within a static member function as they are within a non-static
378378
member function). \begin{note} This is because declaration matching does not
379-
occur until the complete declarator is known. \end{note} Unlike the object
380-
expression in other contexts, \tcode{*this} is not required to be of complete
381-
type for purposes of class member access~(\ref{expr.ref}) outside the member
382-
function body. \begin{note} Only class members declared prior to the declaration
383-
are visible. \end{note}
379+
occur until the complete declarator is known. \end{note}
380+
\begin{note}
381+
In a \grammarterm{trailing-return-type},
382+
the class being defined is not required to be complete
383+
for purposes of class member access~(\ref{expr.ref}).
384+
Class members declared later are not visible.
384385
\begin{example}
385386
\begin{codeblock}
386387
struct A {
@@ -391,6 +392,7 @@
391392
template auto A::f(int t) -> decltype(t + g());
392393
\end{codeblock}
393394
\end{example}
395+
\end{note}
394396

395397
\pnum
396398
Otherwise, if a \grammarterm{member-declarator} declares a non-static data
@@ -1843,9 +1845,15 @@
18431845
\pnum
18441846
\indextext{type!incomplete}%
18451847
For the first option (dot) the first expression
1846-
shall be a glvalue having complete class type.
1848+
shall be a glvalue having class type.
18471849
For the second option (arrow) the first expression
1848-
shall be a prvalue having pointer to complete class type.
1850+
shall be a prvalue having pointer to class type.
1851+
In both cases, the class type shall be complete
1852+
unless the class member access appears in the definition of that class.
1853+
\begin{note}
1854+
If the class is incomplete, lookup in the complete class type
1855+
is required to refer to the same declaration~(\ref{basic.scope.class}).
1856+
\end{note}
18491857
The expression \tcode{E1->E2} is
18501858
converted to the equivalent form \tcode{(*(E1)).E2}; the remainder of
18511859
\ref{expr.ref}~will address only the first option (dot).\footnote{Note that

0 commit comments

Comments
 (0)