diff --git a/source/expressions.tex b/source/expressions.tex index f28dc349b9..4e21d1c139 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -4433,7 +4433,7 @@ \begin{bnf} \nontermdef{noptr-new-declarator}\br - \terminal{[} expression \terminal{]} \opt{attribute-specifier-seq}\br + \terminal{[} \opt{expression} \terminal{]} \opt{attribute-specifier-seq}\br noptr-new-declarator \terminal{[} constant-expression \terminal{]} \opt{attribute-specifier-seq} \end{bnf} @@ -4547,9 +4547,6 @@ \grammarterm{noptr-new-declarator} shall be a converted constant expression\iref{expr.const} of type \tcode{std::size_t} and shall evaluate to a strictly positive value. -\indextext{\idxcode{new}}% -The \grammarterm{expression} in a \grammarterm{noptr-new-declarator} is -implicitly converted to \tcode{std::size_t}. \begin{example} Given the definition \tcode{int n = 42}, \tcode{new float[n][5]} is well-formed (because \tcode{n} is the @@ -4559,9 +4556,20 @@ \end{example} \pnum +If the \grammarterm{type-id} or \grammarterm{new-type-id} +denotes an array type of unknown bound\iref{dcl.array}, +the \grammarterm{new-initializer} shall not be omitted; +the allocated object is an array with \tcode{n} elements, +where \tcode{n} is determined from the number of initial elements +supplied in +the \grammarterm{new-initializer}~(\ref{dcl.init.aggr}, \ref{dcl.init.string}). + +\pnum +\indextext{\idxcode{new}}% +If the \grammarterm{expression} in a \grammarterm{noptr-new-declarator} +is present, it is implicitly converted to \tcode{std::size_t}. \indextext{function!allocation}% -The \grammarterm{expression} in a \grammarterm{noptr-new-declarator} is -erroneous if: +The \grammarterm{expression} is erroneous if: \begin{itemize} \item