In the following scenario:
struct Foo
{
// ...
operator Bar() {... } // implicit cast to Bar
}
Foo GetFoo() { ... }
void CallMeBar(Bar x) { ... }
// ...
Regardless of the cast, the temporary object(s) will "survive" the call to CallMe()
function because of the C++ standard:
12.2.3 [...] Temporary objects are destroyed as the last step in evaluating the fullexpression (1.9) that (lexically) contains the point where they were created. [...]
1.9.12 A fullexpression is an expression that is not a subexpression of another expression.