Re: [C++ Patch/RFC] Back to PR 53159

2014-07-11 Thread Jason Merrill
On 07/10/2014 06:38 PM, Paolo Carlini wrote: if (SCALAR_TYPE_P (type)) + if (!CLASS_TYPE_P (TREE_TYPE (init))) Why this change? check_narrowing only deals with scalar types. Jason

Re: [C++ Patch/RFC] Back to PR 53159

2014-07-10 Thread Paolo Carlini
... and of course the problem with all such ideas is that we easily end up warning twice in all the simple cases which check_narrowing can already handle. Something like the attached has more chances of passing the testsuite while not regressing in terms of duplicate warnings (which are hard to

Re: [C++ Patch/RFC] Back to PR 53159

2014-07-10 Thread Paolo Carlini
... the below is another, very safe, option for setting LOOKUP_NO_NARROWING in flags. Paolo. Index: call.c === --- call.c (revision 212431) +++ call.c (working copy) @@ -3586,7 +3586,8 @@ build_user_type_conversion_1 (tree

Re: [C++ Patch/RFC] Back to PR 53159

2014-07-10 Thread Paolo Carlini
Hi, On 07/10/2014 10:55 PM, Jason Merrill wrote: Hmm, why aren't we already getting the error from if (convs->check_narrowing) check_narrowing (totype, expr); in convert_like_real? Is it that we need to copy LOOKUP_NO_NARROWING into convflags in build_user_type_conversion_1? Ah, ah,

Re: [C++ Patch/RFC] Back to PR 53159

2014-07-10 Thread Jason Merrill
Hmm, why aren't we already getting the error from if (convs->check_narrowing) check_narrowing (totype, expr); in convert_like_real? Is it that we need to copy LOOKUP_NO_NARROWING into convflags in build_user_type_conversion_1? Jason

[C++ Patch/RFC] Back to PR 53159

2014-07-10 Thread Paolo Carlini
Hi, after more than 2 years, I'm finally back to this issue: https://gcc.gnu.org/ml/gcc-patches/2012-05/msg01442.html https://gcc.gnu.org/ml/gcc-patches/2012-05/msg01502.html and the below draft, which passes testing, tries to implement as closely as possible what Jason suggested in th