On 06/17/2015 04:44 PM, Jason Merrill wrote:
Now that reshape_init can return a non-CONSTRUCTOR, we need to call it
earlier in implicit_conversion.

I haven't noticed any problems with the original patch, but just to be safe this patch limits the new reshape to the same conditions as the old one: only classes.

Tested x86_64-pc-linux-gnu,

commit 98a362ded24db54963524761c3b0613ff844de51
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Jun 19 15:29:58 2015 -0400

    	PR c++/66515
    	* call.c (implicit_conversion): Only reshape for classes.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index ba5da4c..a6c313a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1759,8 +1759,9 @@ implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
 
   /* Call reshape_init early to remove redundant braces.  */
   if (expr && BRACE_ENCLOSED_INITIALIZER_P (expr)
+      && CLASS_TYPE_P (to)
       && COMPLETE_TYPE_P (complete_type (to))
-      && CP_AGGREGATE_TYPE_P (to))
+      && !CLASSTYPE_NON_AGGREGATE (to))
     {
       expr = reshape_init (to, expr, complain);
       if (expr == error_mark_node)

Reply via email to