Skip to content

Commit

Permalink
[expr.new] Extend example for new-expressions with zero size arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisenwave committed Jun 12, 2024
1 parent b80d382 commit a5d04d6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5285,6 +5285,15 @@
\grammarterm{expression} of a \grammarterm{noptr-new-declarator}), but
\tcode{new float[5][n]} is ill-formed (because \tcode{n} is not a
constant expression).
Furthermore,
\tcode{new float[0]} is well-formed
(because \tcode{0} is the \grammarterm{expression}
of a \grammarterm{noptr-new-declarator},
where a value of zero results in the allocation of an array with no elements),
but \tcode{new float[n][0]} is ill-formed
(because \tcode{0} is the \grammarterm{constant-expression}
of a \grammarterm{noptr-new-declarator},
where only values greater than zero are allowed).
\end{example}

\pnum
Expand Down

0 comments on commit a5d04d6

Please sign in to comment.