Re: [C++ Patch] PR 51312

2014-08-09 Thread Paolo Carlini
Hi, On 08/09/2014 03:33 AM, Jason Merrill wrote: On 08/08/2014 07:26 PM, Paolo Carlini wrote: Ok (that seems a latent buglet...). By the way, since I wondered briefly about SFINAE wrt the existing documentation, does what we do in the *non* constant case really matter for SFINAE? Yes; in unev

Re: [C++ Patch] PR 51312

2014-08-08 Thread Jason Merrill
On 08/08/2014 07:26 PM, Paolo Carlini wrote: Ok (that seems a latent buglet...). By the way, since I wondered briefly about SFINAE wrt the existing documentation, does what we do in the *non* constant case really matter for SFINAE? Yes; in unevaluated context, at least. Anyway, Ok if testing

Re: [C++ Patch] PR 51312

2014-08-08 Thread Paolo Carlini
.. by^2 the way, I think c++/57460 my have something to do with my curiosities about non-constant vs SFINAE... Paolo.

Re: [C++ Patch] PR 51312

2014-08-08 Thread Paolo Carlini
Hi, On 08/08/2014 11:18 PM, Jason Merrill wrote: On 08/08/2014 04:52 PM, Paolo Carlini wrote: + else if (!TREE_CONSTANT (init)) +{ + if (complain & tf_warning_or_error) +pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, + "narrowing conversion

Re: [C++ Patch] PR 51312

2014-08-08 Thread Jason Merrill
On 08/08/2014 04:52 PM, Paolo Carlini wrote: + else if (!TREE_CONSTANT (init)) + { + if (complain & tf_warning_or_error) + pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing, +"narrowing conversion of %qE from %qT to %qT inside { }", +

Re: [C++ Patch] PR 51312

2014-08-08 Thread Paolo Carlini
Hi, On 08/08/2014 08:22 PM, Jason Merrill wrote: On 08/08/2014 01:04 PM, Paolo Carlini wrote: -float d = { i }; +float d = { i }; // { dg-error "narrowing" } No, this case is the entire point of -Wno-narrowing. I was suggesting that we ignore -Wno-narrowing *for a constant value*, but i is

Re: [C++ Patch] PR 51312

2014-08-08 Thread Jason Merrill
On 08/08/2014 01:04 PM, Paolo Carlini wrote: -float d = { i }; +float d = { i }; // { dg-error "narrowing" } No, this case is the entire point of -Wno-narrowing. I was suggesting that we ignore -Wno-narrowing *for a constant value*, but i is not a constant-expression. Jason

Re: [C++ Patch] PR 51312

2014-08-08 Thread Paolo Carlini
Hi, On 08/08/2014 03:55 PM, Jason Merrill wrote: On 08/08/2014 06:03 AM, Paolo Carlini wrote: Note - in fact I noticed this some days ago - that probably the idea of passing complain to check_narrowing is good anyway, otherwise we have a function emitting unconditional warnings called by functi

Re: [C++ Patch] PR 51312

2014-08-08 Thread Jason Merrill
On 08/08/2014 06:03 AM, Paolo Carlini wrote: Note - in fact I noticed this some days ago - that probably the idea of passing complain to check_narrowing is good anyway, otherwise we have a function emitting unconditional warnings called by functions which have a tsubst_flags_t. Makes sense. Bu

Re: [C++ Patch] PR 51312

2014-08-08 Thread Paolo Carlini
... I'm attaching some code accompanying my blabber. Note - in fact I noticed this some days ago - that probably the idea of passing complain to check_narrowing is good anyway, otherwise we have a function emitting unconditional warnings called by functions which have a tsubst_flags_t. Paolo.

Re: [C++ Patch] PR 51312

2014-08-08 Thread Paolo Carlini
Hi, On 08/07/2014 07:44 PM, Jason Merrill wrote: On 08/07/2014 12:41 PM, Paolo Carlini wrote: Ok. Probably at some point I should review which kind of diagnostics the various implementations emit: for example *for enum27.C* currently clang talks about *narrowing*, the kind of of diagnostics w

Re: [C++ Patch] PR 51312

2014-08-07 Thread Jason Merrill
On 08/07/2014 12:41 PM, Paolo Carlini wrote: Ok. Probably at some point I should review which kind of diagnostics the various implementations emit: for example *for enum27.C* currently clang talks about *narrowing*, the kind of of diagnostics we emit from chech_narrowing; EDG instead produces

Re: [C++ Patch] PR 51312

2014-08-07 Thread Paolo Carlini
Hi, On 08/07/2014 06:32 PM, Jason Merrill wrote: On 08/07/2014 11:28 AM, Jason Merrill wrote: -Wno-narrowing should prevent an error on enum27 Er, should *not*. Ok. Probably at some point I should review which kind of diagnostics the various implementations emit: for example *for enum27.C* c

Re: [C++ Patch] PR 51312

2014-08-07 Thread Jason Merrill
On 08/07/2014 11:28 AM, Jason Merrill wrote: -Wno-narrowing should prevent an error on enum27 Er, should *not*. Jason

Re: [C++ Patch] PR 51312

2014-08-07 Thread Jason Merrill
On 08/07/2014 09:58 AM, Paolo Carlini wrote: Also, I was thinking earlier today that conceptually the check pasted above should check cases different from the cases handled by perform_implicit_conversion_flags, thus, eg, *not* handle enum27.C, because it's an hard error, isn't our standard (and s

Re: [C++ Patch] PR 51312

2014-08-07 Thread Paolo Carlini
Hi, On 08/07/2014 03:24 PM, Jason Merrill wrote: On 08/07/2014 06:49 AM, Paolo Carlini wrote: + if (ENUM_UNDERLYING_TYPE (enumtype)) +value = perform_implicit_conversion_flags + (ENUM_UNDERLYING_TYPE (enumtype), value, tf_warning_or_error, + LOOKUP_IMPLICIT | LOO

Re: [C++ Patch] PR 51312

2014-08-07 Thread Jason Merrill
On 08/07/2014 06:49 AM, Paolo Carlini wrote: + if (ENUM_UNDERLYING_TYPE (enumtype)) + value = perform_implicit_conversion_flags + (ENUM_UNDERLYING_TYPE (enumtype), value, tf_warning_or_error, + LOOKUP_IMPLICIT | LOOKUP_NO_NARROWING); It seems like doin