Skip to content

Commit 8b2c7fc

Browse files
Eisenwavetkoeppe
authored andcommitted
[expr.new] Extend example for new-expressions with zero size arrays
1 parent 0456a32 commit 8b2c7fc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

source/expressions.tex

+9
Original file line numberDiff line numberDiff line change
@@ -5315,6 +5315,15 @@
53155315
\grammarterm{expression} of a \grammarterm{noptr-new-declarator}), but
53165316
\tcode{new float[5][n]} is ill-formed (because \tcode{n} is not a
53175317
constant expression).
5318+
Furthermore,
5319+
\tcode{new float[0]} is well-formed
5320+
(because \tcode{0} is the \grammarterm{expression}
5321+
of a \grammarterm{noptr-new-declarator},
5322+
where a value of zero results in the allocation of an array with no elements),
5323+
but \tcode{new float[n][0]} is ill-formed
5324+
(because \tcode{0} is the \grammarterm{constant-expression}
5325+
of a \grammarterm{noptr-new-declarator},
5326+
where only values greater than zero are allowed).
53185327
\end{example}
53195328

53205329
\pnum

0 commit comments

Comments
 (0)