------- Comment #3 from gdr at cs dot tamu dot edu 2007-08-20 23:23 ------- Subject: Re: C++ frontend should not warn about new a[0] in template context
"mec at google dot com" <[EMAIL PROTECTED]> writes: | "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. Thanks for reminding me that the construct is NOT undefined beahviour. That, I think, also supports the case that we should NOT disable the warning for template instantiations. -- Gaby -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33124