MaterializeTemporaryExpr already contains information about the lifetime
of the temporary; if the lifetime is not the full statement, we do not
want to emit a destructor at the end of the full statement for it.
Details
Details
- Reviewers
jordan_rose
Diff Detail
Diff Detail
Event Timeline
Comment Actions
I second what Alex said, and also wonder if this affects existing destruction of lifetime-extended objects (which happens under the auto destructors path, and is also not quite correct).
Comment Actions
Can you add a test for the subobject case too, even though that doesn't work yet either?
const LifetimeExtend &ref = Aggregate{ 0, 1 }.a; 6; // expect ~Aggregate here rather than ~LifetimeExtend
Other than that, this seems like a fine incremental improvement.
test/Analysis/cfg.cpp | ||
---|---|---|
421–429 | I did not realize this worked. Huh. That's going to be fun. |
Comment Actions
Submitted as r214292. Requested tests in upcoming patch (where they don't crash any more).
I did not realize this worked. Huh. That's going to be fun.