Skip to content

Commit a257a07

Browse files
jensmaurerzygoloid
authored andcommitted
[dcl.spec.auto] Use of undeduced placeholder types
As discussed for CWG 2285, variables declared with a placeholder type should never reference itself in the initializer. Similarly, clarify the treatment of deduced function return types.
1 parent 27d7912 commit a257a07

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/declarations.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,14 +1649,14 @@
16491649
\end{example}
16501650

16511651
\pnum
1652-
If the type of an entity with an undeduced placeholder type is needed to
1653-
determine the type of an expression, the program is ill-formed. Once a
1652+
If the name of an entity with an undeduced placeholder type appears in an
1653+
expression, the program is ill-formed. Once a
16541654
non-discarded \tcode{return} statement has been seen in a function, however, the return type deduced
16551655
from that statement can be used in the rest of the function, including in other
16561656
\tcode{return} statements.
16571657
\begin{example}
16581658
\begin{codeblock}
1659-
auto n = n; // error, \tcode{n}'s type is unknown
1659+
auto n = n; // error, \tcode{n}'s initializer refers to \tcode{n}
16601660
auto f();
16611661
void g() { &f; } // error, \tcode{f}'s return type is unknown
16621662
auto sum(int i) {

0 commit comments

Comments
 (0)