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++] Return error_mark_node from cp_parser_constant_expression


On 06/04/2012 04:12 PM, Florian Weimer wrote:
This doesn't make sense to me. parser->integral_constant_expression_p
should always be true at this point if you're moving the restore later
(which also seems unnecessary).

I think parser->integral_constant_expression_p reflects the result of the cp_parser_assignment_expression() call earlier in this function.

parser->integral_constant_expression_p is set to indicate that the current context expects an integral constant expression; the call to cp_parser_assignment_expression will not affect that.


If the expression turns out not to be a valid constant expression, then we set parser->non_integral_constant_expression_p to true, but we don't touch parser->integral_constant_expression_p. I think the condition you want is

if (parser->non_integral_constant_expression_p
    && !allow_non_constant_p)

Jason


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