https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67981
Casey Carter <Casey at Carter dot net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |Casey at Carter dot net --- Comment #1 from Casey Carter <Casey at Carter dot net> --- I think this is a bug in the standard, and not a bug in GCC. noptr-new-declarator has two grammar productions: noptr-new-declarator: [ expression ] attribute-specifier-seq_opt noptr-new-declarator [ constant-expression ] attribute-specifier-seq_opt with the intent being that all but the first dimension in a multi-dimensional array new expression must be constant expressions, while the first dimension can be a non-constant expression. It would be peculiar if "new int[0]" were to be ill-formed whereas "int n = 0; new int[n];" were to be well-formed, which it very clearly is by 5.3.4/7: "... When the value of the expression is zero, the allocation function is called to allocate an array with no elements." The confusion arises here because the wording uses "constant-expression" to describe occurrences of the second grammar production of noptr-new-declarator, and "expression" to describe occurrences of the first production, which is ambiguous when the expression also happens to be a constant-expression.