From a5d04d68aa3a36c62127fd1102d6b9810c6cc9ec 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..b17a58b639 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