https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67981

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Casey Carter from comment #1)
> I think this is a bug in the standard, and not a bug in GCC.

Thanks.  I've been thinking about this and I suspect you're right that it's my
misreading of the standard and not a bug in GCC.  A slightly more involved test
case shows that GCC does diagnose zero-size arrays in new expressions when the
zero is the constant-expression and that it only accepts such arrays when the
first expression is zero (as does Clang).

$ echo "void* f () { return new char [1][0]; }" | ~/bin/gcc-5.1.0/bin/g++ -Wall
-Wextra -Wpedantic -c -std=c++11 -xc++ -
<stdin>: In function ‘void* f()’:
<stdin>:1:35: warning: ISO C++ forbids zero-size array [-Wpedantic]

Let me resolve this as invalid.

Reply via email to