This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: delete[] works on static arrays
- To: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Subject: Re: delete[] works on static arrays
- From: Jason Merrill <jason at cygnus dot com>
- Date: 07 Jun 1998 18:41:05 -0700
- Cc: Guillaume Laurent <glaurent at worldnet dot fr>, egcs-bugs at cygnus dot com, egcs-patches at cygnus dot com
- References: <m3zpfpwpcr.fsf@linux2.worldnet.fr> <oryav9ez9b.fsf@zecarneiro.lsd.dcc.unicamp.br>
>>>>> Alexandre Oliva <oliva@dcc.unicamp.br> writes:
> --Multipart_Sun_Jun__7_17:24:32_1998-1
> Content-Type: text/plain; charset=US-ASCII
> Guillaume Laurent <glaurent@worldnet.fr> writes:
>> The following compiles cleanly with egcs 1.0.3, while it shouldn't :
>> int main(void) { char a[120]; delete[] a; return 0; }
I'm not sure about that. The draft says
The operand shall have a pointer type, or a class type having
a single conversion function (_class.conv.fct_) to a pointer type.
but it also says, about array references, that
One of the expressions shall have the type "pointer to T"
so I think that the pointer can be the result of the default
array-to-pointer conversion. If so, this code is well-formed, and the
current error message for 'delete' is wrong. Existing practice is mixed.
EDG, Sun and Diab accept it; HP and IBM reject it.
I would suggest moving the check to before the switch, making it a
warning, and adding a call to build_expr_type_conversion.
Jason