re PR c++/23372 (Temporary aggregate copy not elided when passing parameters by value)
authorJason Merrill <jason@redhat.com>
Wed, 23 Aug 2006 04:27:43 +0000 (00:27 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 23 Aug 2006 04:27:43 +0000 (00:27 -0400)
        PR c++/23372
        * call.c (build_over_call): Don't make a copy here if build_call
        will make one too.

From-SVN: r116342

gcc/cp/ChangeLog
gcc/cp/call.c

index f50554cab565becfd4a3bfd33ff0aca2ccd106d7..ff60084b83c904dcdc86b30b887a852e1a661cc1 100644 (file)
@@ -1,3 +1,9 @@
+2006-08-22  Jason Merrill  <jason@redhat.com>
+
+       PR c++/23372
+       * call.c (build_over_call): Don't make a copy here if build_call 
+       will make one too.
+
 2006-08-22  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR C++/28450
index ea89cdfed771564fca0d1f2bceccc0e7de5e2326..a91ecd015f8c3f9840fcb1251654d5342d4c168d 100644 (file)
@@ -4847,6 +4847,12 @@ build_over_call (struct z_candidate *cand, int flags)
       tree type = TREE_VALUE (parm);
 
       conv = convs[i];
+
+      /* Don't make a copy here if build_call is going to.  */
+      if (conv->kind == ck_rvalue
+         && !TREE_ADDRESSABLE (complete_type (type)))
+       conv = conv->u.next;
+
       val = convert_like_with_context
        (conv, TREE_VALUE (arg), fn, i - is_method);