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