This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] [PR14181] Emit good diagnostic for invalid new expression


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]