https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91465

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This is the fix, thought I recall it broke something.  But we want to use fold_
here because we can have a non-dependent template code like CAST_EXPR.

--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -981,7 +981,7 @@ check_narrowing (tree type, tree init, tsubst_flags_t
complain,
       return ok;
     }

-  init = maybe_constant_value (init);
+  init = fold_non_dependent_expr (init, complain);

   /* If we were asked to only check constants, return early.  */
   if (const_only && !TREE_CONSTANT (init))

Reply via email to