On Wed, Jan 23, 2019 at 12:57 PM Marek Polacek <pola...@redhat.com> wrote:
>
> On Wed, Jan 23, 2019 at 09:00:36AM -0500, Jason Merrill wrote:
> > I was talking about digest_init, not reshape_init.  digest_init calls
> > convert_for_initialization.
>
> /facepalm
>
> So yes, digest_init calls convert_for_initialization which will end up
> calling perform_implicit_conversion_flags which could call convert_like_real
> where the narrowing warnings are given, but it doesn't, we go to this case:
>
>   else if (processing_template_decl && conv->kind != ck_identity)
>     {
>       /* In a template, we are only concerned about determining the
>          type of non-dependent expressions, so we do not have to
>          perform the actual conversion.  But for initializers, we
>          need to be able to perform it at instantiation
>          (or instantiate_non_dependent_expr) time.  */
>       expr = build1 (IMPLICIT_CONV_EXPR, type, expr);
>
> finish_decltype_type throws away the expression because it's not dependent, 
> and
> only uses its type.  So narrowing remains undetected.  Not sure if I should 
> mess
> with perform_implicit_conversion_flags.

Let's try that; this is a situation where the comment is incorrect.
Perhaps just call check_narrowing here if appropriate, rather than go
through the whole conversion machinery.

Jason

Reply via email to