------- Comment #2 from mec at google dot com  2007-08-20 19:31 -------
"new T[0]" looks like defined behavior to me.

[expr.new] 5.3.4 -7-
When the value of the expression in a direct-new-declarator is zero, the
allocation function is called to allocate an array with no elements.  The
pointer returend by the new-expression is non-null.  [Note: if the library
allocation function is called, the pointer returned is distinct from the the
pointer to any other object.]

===

cp/init.c even quotes that section in a comment before giving the warning. 
cp/init.c goes on to say "However, that is not generally useful, so we issue a
warning".  new T[0] is valid C++ and here is a useful case.


-- 

mec at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mec at google dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33124

Reply via email to