This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] [PR14181] Emit good diagnostic for invalid new expression
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Giovanni Bajo <giovannibajo at libero dot it>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 18 Feb 2004 17:07:24 -0800
- Subject: Re: [C++ PATCH] [PR14181] Emit good diagnostic for invalid new expression
- Organization: CodeSourcery, LLC
- References: <206501c3f615$c63edae0$aa422597@bagio>
Giovanni Bajo wrote:
Hello,
this code:
-----------------
int* a = new (int)[10];
-----------------
used to be accepted by GCC 3.3.x (unless pedantic). It's now rejected by the
new parser, but the current error message is just a parse error:
-----------------
error: expected `;' before '[' token
-----------------
I think we're sort-of picking nits here -- that's really not a bad error
message. It makes it pretty clear that the problem likes with the
"[10]" bit.
I guess if you think this is important the patch is OK, though, but
instead of:
error: use of parenthesis around the type name is not allowed while allocating
an array
let's go all the way:
error: array bound forbidden after parenthesized type-id
inform: try removing the parentheses around the type-id
OK for 3.4 and mainline with that change.
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com