From 88c4fd344d8e3c78f86fd5bc10f756ac1ba21ecf Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Mon, 10 Jun 2024 23:22:04 +0200 Subject: [PATCH] [expr.new] Extend example for new-expressions with zero size arrays --- source/expressions.tex | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/expressions.tex b/source/expressions.tex index 683b30137f..4b65e61a87 100644 --- a/source/expressions.tex +++ b/source/expressions.tex @@ -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