diff mbox

Trivial C++ PATCH to implicit_conversion

Message ID 4E6E463A.4040902@redhat.com
State New
Headers show

Commit Message

Jason Merrill Sept. 12, 2011, 5:49 p.m. UTC
While looking at something else I noticed that the middle test here can 
be much more expensive than the third if the type isn't complete yet, so 
I reordered them.  This shouldn't have a significant effect on any code, 
but seemed like an improvement.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit 540cc1799744041f96fb15b9eea9ec9793725d1d
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Sep 8 10:52:03 2011 -0400

    	* call.c (implicit_conversion): Check BRACE_ENCLOSED_INITIALIZER_P
    	before forcing instantiation.

diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index c707d66..62bee2d 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -1848,8 +1848,8 @@  implicit_conversion (tree to, tree from, tree expr, bool c_cast_p,
 				|LOOKUP_NO_NARROWING));
 
       if (CLASS_TYPE_P (to)
-	  && !CLASSTYPE_NON_AGGREGATE (complete_type (to))
-	  && BRACE_ENCLOSED_INITIALIZER_P (expr))
+	  && BRACE_ENCLOSED_INITIALIZER_P (expr)
+	  && !CLASSTYPE_NON_AGGREGATE (complete_type (to)))
 	return build_aggr_conv (to, expr, flags);
 
       cand = build_user_type_conversion_1 (to, expr, convflags);