[cfe-dev] GCC's "Temporaries May Vanish Before You Expect"
jordan_rose at apple.com
Wed Sep 12 17:11:28 PDT 2012
On Sep 12, 2012, at 17:08 , Sean Silva <silvas at purdue.edu> wrote:
> Does that mean that:
> is unsafe?
> because I've seen a couple of those around.
No, that's fine. Temporaries are destroyed "at the end of a full-expression", which is basically "the outermost expression". So the temporary will stay live until the call to doSomething completes.
>> , the latter of which is slightly more ugly.
> Would it be possible to make dyn_cast a bit smarter so that it will
> look into an iterator's member typedefs and automatically do the
> trivial &* stuff itself?
In theory, yes. In practice, I'm not sure if we want simplify_type to be that smart. I haven't thought it through, though.
More information about the cfe-dev