This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Trivial C++ PATCH to implicit_conversion


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.
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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]