|
1709 | 1709 | each of which shall
|
1710 | 1710 | be followed by a non-empty
|
1711 | 1711 | \grammarterm{initializer}.
|
1712 |
| -If the \grammarterm{initializer} is a parenthesized \grammarterm{expression-list}, |
1713 |
| -the \grammarterm{expression-list} shall be a single \grammarterm{assignment-expression}. |
1714 | 1712 | \begin{example}
|
1715 | 1713 | \begin{codeblock}
|
1716 | 1714 | auto x = 5; // OK: \tcode{x} has type \tcode{int}
|
|
1896 | 1894 |
|
1897 | 1895 | \pnum
|
1898 | 1896 | A type \tcode{T} containing a placeholder type,
|
1899 |
| -and a corresponding initializer $E$, |
| 1897 | +and a corresponding \grammarterm{initializer-clause} $E$, |
1900 | 1898 | are determined as follows:
|
1901 | 1899 | \begin{itemize}
|
1902 | 1900 | \item
|
1903 |
| -for a non-discarded \tcode{return} statement that occurs |
| 1901 | +For a non-discarded \tcode{return} statement that occurs |
1904 | 1902 | in a function declared with a return type
|
1905 | 1903 | that contains a placeholder type,
|
1906 |
| -\tcode{T} is the declared return type |
1907 |
| -and $E$ is the operand of the \tcode{return} statement. |
1908 |
| -If the \tcode{return} statement |
1909 |
| -has no operand, |
1910 |
| -then $E$ is \tcode{void()}; |
| 1904 | +\tcode{T} is the declared return type. |
| 1905 | +\begin{itemize} |
| 1906 | +\item |
| 1907 | +If the \tcode{return} statement has no operand, |
| 1908 | +then $E$ is \tcode{void()}. |
| 1909 | +\item |
| 1910 | +If the operand is a \grammarterm{braced-init-list}\iref{dcl.init.list}, |
| 1911 | +the program is ill-formed. |
| 1912 | +\item |
| 1913 | +If the operand is an \grammarterm{expression} $X$ |
| 1914 | +that is not an \grammarterm{assignment-expression}, |
| 1915 | +$E$ is \tcode{($X$)}. |
| 1916 | +\begin{note} |
| 1917 | +A comma expression\iref{expr.comma} is not |
| 1918 | +an \grammarterm{assignment-expression}. |
| 1919 | +\end{note} |
1911 | 1920 | \item
|
1912 |
| -for a variable declared with a type |
| 1921 | +Otherwise, $E$ is the operand of the \tcode{return} statement. |
| 1922 | +\end{itemize} |
| 1923 | +If $E$ has type \keyword{void}, |
| 1924 | +\tcode{T} shall be either |
| 1925 | +\opt{\grammarterm{type-constraint}} \tcode{decltype(auto)} or |
| 1926 | +\cv{}~\opt{\grammarterm{type-constraint}} \keyword{auto}. |
| 1927 | +\item |
| 1928 | +For a variable declared with a type |
1913 | 1929 | that contains a placeholder type,
|
1914 |
| -\tcode{T} is the declared type of the variable |
1915 |
| -and $E$ is the initializer. |
1916 |
| -If the initialization is direct-list-initialization, |
1917 |
| -the initializer shall be a \grammarterm{braced-init-list} |
1918 |
| -containing only a single \grammarterm{assignment-expression} |
1919 |
| -and $E$ is the \grammarterm{assignment-expression}; |
| 1930 | +\tcode{T} is the declared type of the variable. |
| 1931 | +\begin{itemize} |
1920 | 1932 | \item
|
1921 |
| -for a non-type template parameter declared with a type |
| 1933 | +If the initializer of the variable is a \grammarterm{brace-or-equal-initializer} |
| 1934 | +of the form \tcode{= \grammarterm{initializer-clause}}, |
| 1935 | +$E$ is the \grammarterm{initializer-clause}. |
| 1936 | +\item |
| 1937 | +If the initializer is a \grammarterm{braced-init-list}, |
| 1938 | +it shall consist of a single brace-enclosed \grammarterm{initializer-clause} |
| 1939 | +and the \grammarterm{initializer-clause} shall be |
| 1940 | +an \grammarterm{assignment-expression}, |
| 1941 | +and $E$ is the \grammarterm{assignment-expression}. |
| 1942 | +\item |
| 1943 | +If the initializer is a parenthesized \grammarterm{expression-list}, |
| 1944 | +the \grammarterm{expression-list} shall be |
| 1945 | +a single \grammarterm{assignment-expression} |
| 1946 | +and $E$ is the \grammarterm{assignment-expression}. |
| 1947 | +\end{itemize} |
| 1948 | +\item |
| 1949 | +For a non-type template parameter declared with a type |
1922 | 1950 | that contains a placeholder type,
|
1923 | 1951 | \tcode{T} is the declared type of the non-type template parameter
|
1924 | 1952 | and $E$ is the corresponding template argument.
|
1925 | 1953 | \end{itemize}
|
1926 | 1954 |
|
1927 |
| -In the case of a \tcode{return} statement with no operand |
1928 |
| -or with an operand of type \keyword{void}, |
1929 |
| -\tcode{T} shall be either |
1930 |
| -\opt{\grammarterm{type-constraint}} \tcode{decltype(auto)} or |
1931 |
| -\cv{}~\opt{\grammarterm{type-constraint}} \keyword{auto}. |
1932 |
| - |
1933 |
| -\pnum |
1934 |
| -If the deduction is for a \tcode{return} statement |
1935 |
| -and $E$ is a \grammarterm{braced-init-list}\iref{dcl.init.list}, |
1936 |
| -the program is ill-formed. |
1937 |
| - |
1938 | 1955 | \pnum
|
1939 | 1956 | If the \grammarterm{placeholder-type-specifier} is of the form
|
1940 | 1957 | \opt{\grammarterm{type-constraint}} \keyword{auto},
|
|
0 commit comments