From: Jason Merrill Date: Wed, 23 Aug 2006 14:22:41 +0000 (-0400) Subject: re PR c++/23372 (Temporary aggregate copy not elided when passing parameters by value) X-Git-Tag: releases/gcc-4.0.4~425 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5b6c65a791f2c20d3ba528f0b0e229f5208913a;p=thirdparty%2Fgcc.git re PR c++/23372 (Temporary aggregate copy not elided when passing parameters by value) PR c++/23372 * call.c (build_over_call): Don't make a copy here if build_call will make one too. From-SVN: r116351 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0f842278c763..c865690eb00a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-22 Jason Merrill + + PR c++/23372 + * call.c (build_over_call): Don't make a copy here if build_call + will make one too. + 2006-08-17 Jason Merrill PR c++/28385 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index aaee1fb36c9e..da3ea1da226b 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4780,6 +4780,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);