temporary object, function parameters and implicit cast
<p>In the following scenario:</p>

<pre><code>struct Foo
{
   // ...
   operator Bar() {... }  // implicit cast to Bar
}

Foo GetFoo() { ... }
void CallMeBar(Bar x) { ... }

// ...
CallMeBar( GetFoo() );
</code></pre>

<p>[edit] fixed the cast operator, d'oh[/edit]</p>

<p><code>GetFoo</code> returns a temporary object of Type Foo. Does this object survive until after CallMe returns? What does the standard say?</p>

<p>I understand that if <code>CallMe</code> would accept  Foo, the temporary object would not be destroyed until after <code>CallMe</code> returns. I am not sure, however, fi the implicit cast changes this, and only the temporary <code>Bar</code> is guaranteed to survive. </p>

<p><hr></p>

<p>A typical case would be Foo = CString, Bar = char *, i.e. Bar referencing data held by (and freed by) Foo. </p>
