Zdenek Dvorak wrote:

> umm... OK.  Could you please provide an example (that could perhaps also
> be added to documentation) of how TARGET_EXPRs are used, that would
> explain the rationale behind this semantics?

The canonical example is:

  struct S {
    S();
    S(const S&);
  };
  S f();
  void g() {
    S s = f();
  }

Here, we want to elide the copy from f() into s; therefore, the value of
f() is represented as a TARGET_EXPR.  Since it appears as the RHS of an
assignment, the middle end is required to pass the address of s to f,
rather than the address of a temporary, so that f will construct the
value directly into s.

-- 
Mark Mitchell
CodeSourcery
[EMAIL PROTECTED]
(650) 331-3385 x713

Reply via email to