Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-14 Thread Jason Merrill
On 11/14/2014 08:46 AM, Paolo Carlini wrote: +/* Like maybe_constant_value but first fully constant fold the argument. */ "but first fully instantiate the argument." OK with that change, thanks. Jason

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-14 Thread Paolo Carlini
Hi, On 11/14/2014 03:35 AM, Jason Merrill wrote: On 11/13/2014 04:31 PM, Paolo Carlini wrote: I think this should be replaced with fold_ if (processing_template_decl) in build_enumerator. Ok. The value can be NULL_TREE, thus in a straightforward change (per the below) I have to check for that,

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Jason Merrill
On 11/13/2014 04:31 PM, Paolo Carlini wrote: I think this should be replaced with fold_ if (processing_template_decl) in build_enumerator. Ok. The value can be NULL_TREE, thus in a straightforward change (per the below) I have to check for that, otherwise we crash in maybe_constant_value. Either

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Paolo Carlini
Hi, On 11/13/2014 07:31 PM, Jason Merrill wrote: On 11/13/2014 12:48 PM, Paolo Carlini wrote: While we are at it, can you double check that in end_maybe_infinite_loop we really want the non-sfinae version (which in principle can emit hard errors): the inconsistency with begin_maybe_infinite_loo

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Jason Merrill
On 11/13/2014 12:48 PM, Paolo Carlini wrote: While we are at it, can you double check that in end_maybe_infinite_loop we really want the non-sfinae version (which in principle can emit hard errors): the inconsistency with begin_maybe_infinite_loop seems weird to me... I agree, let's use the sfi

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Paolo Carlini
Hi, On 11/13/2014 05:42 PM, Jason Merrill wrote: On 11/13/2014 11:10 AM, Jason Merrill wrote: On 11/13/2014 05:47 AM, Paolo Carlini wrote: shall we do something like the below? Something similar, yes. Though it would also be nice to avoid the redundant checking in the two functions: we only

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Jason Merrill
On 11/13/2014 11:10 AM, Jason Merrill wrote: On 11/13/2014 05:47 AM, Paolo Carlini wrote: shall we do something like the below? Something similar, yes. Though it would also be nice to avoid the redundant checking in the two functions: we only want to do constexpr folding if we did the tsubst.

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Kai Tietz
2014-11-13 17:10 GMT+01:00 Jason Merrill : > On 11/13/2014 05:47 AM, Paolo Carlini wrote: >> >> shall we do something like the below? > > > Something similar, yes. Though it would also be nice to avoid the redundant > checking in the two functions: we only want to do constexpr folding if we > did

Re: [C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Jason Merrill
On 11/13/2014 05:47 AM, Paolo Carlini wrote: shall we do something like the below? Something similar, yes. Though it would also be nice to avoid the redundant checking in the two functions: we only want to do constexpr folding if we did the tsubst. Kai is working on folding changes, so I t

[C++ Patch] Add maybe_constant_folded_value

2014-11-13 Thread Paolo Carlini
Hi, shall we do something like the below? Safety checked x86_64-linux. Thanks, Paolo. /// 2014-11-13 Paolo Carlini * constexpr.c (maybe_constant_folded_value): Add. * cp-tree.h (maybe_constant_folded_value): Declare it. * call.c (null_ptr_cst_p): Use