Re: [C++ Patch] PR 51225

2012-01-18 Thread Jason Merrill
OK. Jason

Re: [C++ Patch] PR 51225

2012-01-18 Thread Paolo Carlini
Hi, So, the issue here is that fold_non_dependent_expr_sfinae checks potential_constant_expression, and doesn't fold anything which isn't one. One approach would be to only guard cxx_constant_value with require_potential_constant_expression within a template. Thanks. Thus I tried to implement

Re: [C++ Patch] PR 51225

2012-01-16 Thread Jason Merrill
So, the issue here is that fold_non_dependent_expr_sfinae checks potential_constant_expression, and doesn't fold anything which isn't one. One approach would be to only guard cxx_constant_value with require_potential_constant_expression within a template. Another approach would be to check po

Re: [C++ Patch] PR 51225

2012-01-14 Thread Paolo Carlini
Hi, On 01/13/2012 03:57 PM, Paolo Carlini wrote: 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

Re: [C++ Patch] PR 51225

2012-01-13 Thread Jason Merrill
On 01/13/2012 03:57 PM, Paolo Carlini wrote: 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_buil

Re: [C++ Patch] PR 51225

2012-01-13 Thread Paolo Carlini
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_expressi

Re: [C++ Patch] PR 51225

2012-01-13 Thread Jason Merrill
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; t

[C++ Patch] PR 51225

2012-01-13 Thread Paolo Carlini
Hi, 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. The latter trees are currently completely unhandled by cxx_eval_constant_expression, thus in order to avoid such IC