Patchwork C++ PATCH for c++/48873 (unnecessary dtor calls in new-expressions)

login
register
mail settings
Submitter Jason Merrill
Date May 20, 2011, 8:36 p.m.
Message ID <4DD6D0C9.1030502@redhat.com>
Download mbox | patch
Permalink /patch/96666/
State New
Headers show

Comments

Jason Merrill - May 20, 2011, 8:36 p.m.
While thinking about backporting this patch, I noticed a thinko: I was 
applying SCALAR_TYPE_P to the expression itself, not its type.  Oops.

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

Patch

commit 17f3af8efbf2fe2483fd922b42b30585a33095a9
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 20 16:02:53 2011 -0400

    	* tree.c (stabilize_expr): Fix typo.

diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 6b3680e..c93110b 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -3136,7 +3136,7 @@  stabilize_expr (tree exp, tree* initp)
   /* There are no expressions with REFERENCE_TYPE, but there can be call
      arguments with such a type; just treat it as a pointer.  */
   else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
-	   || SCALAR_TYPE_P (exp)
+	   || SCALAR_TYPE_P (TREE_TYPE (exp))
 	   || !lvalue_or_rvalue_with_address_p (exp))
     {
       init_expr = get_target_expr (exp);