|
4433 | 4433 |
|
4434 | 4434 | \begin{bnf}
|
4435 | 4435 | \nontermdef{noptr-new-declarator}\br
|
4436 |
| - \terminal{[} expression \terminal{]} \opt{attribute-specifier-seq}\br |
| 4436 | + \terminal{[} \opt{expression} \terminal{]} \opt{attribute-specifier-seq}\br |
4437 | 4437 | noptr-new-declarator \terminal{[} constant-expression \terminal{]} \opt{attribute-specifier-seq}
|
4438 | 4438 | \end{bnf}
|
4439 | 4439 |
|
|
4547 | 4547 | \grammarterm{noptr-new-declarator} shall be a converted constant
|
4548 | 4548 | expression\iref{expr.const} of type \tcode{std::size_t} and
|
4549 | 4549 | shall evaluate to a strictly positive value.
|
4550 |
| -\indextext{\idxcode{new}}% |
4551 |
| -The \grammarterm{expression} in a \grammarterm{noptr-new-declarator} is |
4552 |
| -implicitly converted to \tcode{std::size_t}. |
4553 | 4550 | \begin{example}
|
4554 | 4551 | Given the definition \tcode{int n = 42},
|
4555 | 4552 | \tcode{new float[n][5]} is well-formed (because \tcode{n} is the
|
|
4559 | 4556 | \end{example}
|
4560 | 4557 |
|
4561 | 4558 | \pnum
|
| 4559 | +If the \grammarterm{type-id} or \grammarterm{new-type-id} |
| 4560 | +denotes an array type of unknown bound\iref{dcl.array}, |
| 4561 | +the \grammarterm{new-initializer} shall not be omitted; |
| 4562 | +the allocated object is an array with \tcode{n} elements, |
| 4563 | +where \tcode{n} is determined from the number of initial elements |
| 4564 | +supplied in |
| 4565 | +the \grammarterm{new-initializer}~(\ref{dcl.init.aggr}, \ref{dcl.init.string}). |
| 4566 | + |
| 4567 | +\pnum |
| 4568 | +\indextext{\idxcode{new}}% |
| 4569 | +If the \grammarterm{expression} in a \grammarterm{noptr-new-declarator} |
| 4570 | +is present, it is implicitly converted to \tcode{std::size_t}. |
4562 | 4571 | \indextext{function!allocation}%
|
4563 |
| -The \grammarterm{expression} in a \grammarterm{noptr-new-declarator} is |
4564 |
| -erroneous if: |
| 4572 | +The \grammarterm{expression} is erroneous if: |
4565 | 4573 |
|
4566 | 4574 | \begin{itemize}
|
4567 | 4575 | \item
|
|
0 commit comments