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++] Reject variably modified types in operator new


On 06/25/2012 08:17 AM, Florian Weimer wrote:
The message should point to the typedef, but instead, it references the
line with operator new (which doesn't even contain the variable n).

Yep, this is another example of how we don't track/use expression locations well enough.


For the non-VLA typedef case, it is an improvement. But I would like to
leave in both errors, as in the attached patch.

OK.


If you have suggestions how to improve cxx_constant_value error
reporting, I can look into that in a separate patch.

One way would be to pass around a location_t loc in the cxx_eval_* functions, starting with input_location, but then at the top of cxx_eval_constant_expression have


if (EXPR_HAS_LOCATION (t))
  loc = EXPR_LOCATION (t);

and use error_at (loc in all error messages.

And perhaps also change array_type_nelts_top to give the PLUS_EXPR (if any) the location of the array typedef (if any).

Bootstrapped and tested on x86_64-unknown-linux-gnu, with no new
regressions. OK for trunk?

Yes.


Jason


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