Skip to content

Commit cb39ab5

Browse files
jensmaurertkoeppe
authored andcommitted
[dcl.type.auto.deduct, expr.type.conv] Rearrange description of 'auto' deduction
This change moves the fact that 'the type shall be auto' from [expr.type.conv] to [dcl.type.auto.deduct], and thus avoids repeating the mechanism of placeholder deduction.
1 parent 21d7303 commit cb39ab5

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

source/declarations.tex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,20 @@
19501950
and $E$ is the \grammarterm{assignment-expression}.
19511951
\end{itemize}
19521952
\item
1953+
For an explicit type conversion\iref{expr.type.conv},
1954+
\tcode{T} is the specified type, which shall be \keyword{auto}.
1955+
\begin{itemize}
1956+
\item
1957+
If the initializer is a \grammarterm{braced-init-list},
1958+
it shall consist of a single brace-enclosed \grammarterm{assignment-expression}
1959+
and $E$ is the \grammarterm{assignment-expression}.
1960+
\item
1961+
If the initializer is a parenthesized \grammarterm{expression-list},
1962+
the \grammarterm{expression-list} shall be
1963+
a single \grammarterm{assignment-expression}
1964+
and $E$ is the \grammarterm{assignment-expression}.
1965+
\end{itemize}
1966+
\item
19531967
For a non-type template parameter declared with a type
19541968
that contains a placeholder type,
19551969
\tcode{T} is the declared type of the non-type template parameter

source/expressions.tex

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,14 +3353,9 @@
33533353
of the function selected by overload resolution
33543354
for class template deduction\iref{over.match.class.deduct}
33553355
for the remainder of this subclause.
3356-
Otherwise, if the type is \tcode{auto},
3357-
it is replaced by the type deduced for the variable \tcode{x}
3358-
in the invented declaration\iref{dcl.spec.auto},
3359-
which is never interpreted as a function declaration:
3360-
\begin{codeblock}
3361-
auto x @\placeholder{init}@;
3362-
\end{codeblock}
3363-
, where \placeholder{init} is the initializer.
3356+
Otherwise, if the type contains a placeholder type,
3357+
it is replaced by the type
3358+
determined by placeholder type deduction\iref{dcl.type.auto.deduct}.
33643359
\begin{example}
33653360
\begin{codeblock}
33663361
struct A {};

0 commit comments

Comments
 (0)