Skip to content

Commit c61e84e

Browse files
committed
[dcl.type.auto.deduct] Clarify initializer for placeholder type deduction.
1 parent 9f894e7 commit c61e84e

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

source/declarations.tex

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,29 +1896,35 @@
18961896

18971897
\pnum
18981898
A type \tcode{T} containing a placeholder type,
1899-
and a corresponding initializer $E$,
1899+
and a corresponding \grammarterm{initializer-clause} $E$,
19001900
are determined as follows:
19011901
\begin{itemize}
19021902
\item
1903-
for a non-discarded \tcode{return} statement that occurs
1903+
For a non-discarded \tcode{return} statement that occurs
19041904
in a function declared with a return type
19051905
that contains a placeholder type,
19061906
\tcode{T} is the declared return type
1907-
and $E$ is the operand of the \tcode{return} statement.
1907+
and $E$ is the operand of the \tcode{return} statement;
1908+
if the operand is an \grammarterm{expression} $X$
1909+
that is not an \grammarterm{assignment-expression}\iref{expr.comma},
1910+
$E$ is \tcode{($X$)}.
19081911
If the \tcode{return} statement
19091912
has no operand,
1910-
then $E$ is \tcode{void()};
1913+
then $E$ is \tcode{void()}.
19111914
\item
1912-
for a variable declared with a type
1915+
For a variable declared with a type
19131916
that contains a placeholder type,
1914-
\tcode{T} is the declared type of the variable
1915-
and $E$ is the initializer.
1917+
\tcode{T} is the declared type of the variable.
1918+
If the initializer of the variable is a \grammarterm{brace-or-equal-initializer}
1919+
of the form \tcode{= \grammarterm{initializer-clause}},
1920+
$E$ is the \grammarterm{initializer-clause}.
19161921
If the initialization is direct-list-initialization,
19171922
the initializer shall be a \grammarterm{braced-init-list}
19181923
containing only a single \grammarterm{assignment-expression}
1919-
and $E$ is the \grammarterm{assignment-expression};
1924+
and $E$ is the \grammarterm{assignment-expression}.
1925+
Otherwise, $E$ is the initializer.
19201926
\item
1921-
for a non-type template parameter declared with a type
1927+
For a non-type template parameter declared with a type
19221928
that contains a placeholder type,
19231929
\tcode{T} is the declared type of the non-type template parameter
19241930
and $E$ is the corresponding template argument.

0 commit comments

Comments
 (0)