On 06/05/2012 11:19 AM, Florian Weimer wrote:
True. But if we want cascading errors, cp_parser_constant_expression
really cannot return error_mark_node, so this approach is a dead end.
(For example, build_enumerator replaces error_mark_node in the
enumeration value with nothing, i.e., the next possible enumeration value.)
So this approach is a dead end. On the other hand, if cascading errors
are acceptable, I probably should not worry too much about them in
operator new, either. 8-)
It really depends. The error messages I was talking about before add
more context information to the the previous error, which is good.
Better would be to have set a constant expression context somewhere so
that we can cover both the context and the violation in one error message.
In the operator new case, the non-constant expression error followed by
the VLA warning is not as helpful, as the latter ignores the former.
Perhaps the right way to deal with this is to allow non-constant
expressions in the new-type-id, since we allow them in a regular type-id.
Jason