diff mbox

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

Message ID 53BF136E.4040906@oracle.com
State New
Headers show

Commit Message

Paolo Carlini July 10, 2014, 10:27 p.m. UTC
... the below is another, very safe, option for setting 
LOOKUP_NO_NARROWING in flags.

Paolo.
diff mbox

Patch

Index: call.c
===================================================================
--- call.c	(revision 212431)
+++ call.c	(working copy)
@@ -3586,7 +3586,8 @@  build_user_type_conversion_1 (tree totype, tree ex
 
   /* It's OK to bind a temporary for converting constructor arguments, but
      not in converting the return value of a conversion operator.  */
-  convflags = ((flags & LOOKUP_NO_TEMP_BIND) | LOOKUP_NO_CONVERSION);
+  convflags = ((flags & LOOKUP_NO_TEMP_BIND) | LOOKUP_NO_CONVERSION
+	       | (flags & LOOKUP_NO_NARROWING));
   flags &= ~LOOKUP_NO_TEMP_BIND;
 
   if (ctors)
Index: decl.c
===================================================================
--- decl.c	(revision 212431)
+++ decl.c	(working copy)
@@ -5755,6 +5755,7 @@  check_initializer (tree decl, tree init, int flags
 	    }
 	  else
 	    {
+	      flags |= LOOKUP_NO_NARROWING;
 	      init = reshape_init (type, init, tf_warning_or_error);
 	      if (SCALAR_TYPE_P (type))
 		check_narrowing (type, init);