Hi,
On 01/13/2012 01:16 PM, Paolo Carlini wrote:
in C++11 mode after erroring out for an undeclared name we can easily
end up calling cxx_eval_constant_expression on a CAST_EXPR etc, which
has error_mark_node as argument.

We should never pass uninstantiated trees to cxx_eval_constant_expression; they need to go through tsubst first.
Actually, I'm pretty sure you explained that already in the past, and I have more generally a deja-vu...

Anyway, the reason we are not tsubst-ing such trees - eg, a CAST_EXPR on a single element TREE_LIST as argument, with error_mark_node as value - is that potential_constant_expression is false in fold_non_dependent_expr_sfinae, thus tsubst_copy_and_build is not called at all. The reason why potential_constant_expression is false is that recursion leads to the argument as a TREE_LIST and then the next call to the error_mark_node itself, which eventually leads to false.

Back to my deja-vu feeling, I'm pretty sure that a few weeks ago I experimented with changing potential_constant_expression to actually return *true* for error_mark_node, and that worked for a similar problem.

But maybe my few lines of analysis already inspire you something?

Thanks,
Paolo.

Reply via email to