This is the mail archive of the gcc-bugs@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]

[Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value


------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de  2005-08-13 18:11 -------
With the copy ctor we end up with

void g(A*) (a)
{
  struct A D.1603;

<bb 0>:
  __comp_ctor  (&D.1603, a);
  f (&D.1603);
  return;

}

which confuses me a bit, because here the prototype of f looks like
effectively

void f(A*);

do we use ABI information here, but not in the other case?  The C++
frontend in this case presents us with

{
  <<cleanup_point <<< Unknown tree: expr_stmt
  f (&TARGET_EXPR <D.1603, <<< Unknown tree: aggr_init_expr
  __comp_ctor
  0B, (struct A &) (struct A *) NON_LVALUE_EXPR <a>
  D.1603 >>>
>) >>>
>>;
}

where in the case w/o the copy ctor we have

  <<cleanup_point <<< Unknown tree: expr_stmt
  f (TARGET_EXPR <D.1608, *(struct A &) (struct A *) NON_LVALUE_EXPR <a>>) >>>
>>;

is there some different wording about by-value parameter passing
with or without explicit copy ctor in the C++ standard?!  I.e., why
isn't the above

  <<cleanup_point <<< Unknown tree: expr_stmt
  f (&TARGET_EXPR <D.1608, *(struct A &) (struct A *) NON_LVALUE_EXPR <a>>) >>>
>>;

?

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23372


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