[clang] [Clang] Mark this pointer in destructors dead_on_return (PR #166276)
Aiden Grossman via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 13:22:56 PST 2025
boomanaiden154 wrote:
> You're correct to be conservative about virtual bases, because they will generally still be live out of the base subobject destructor. I think it's worth doing this for non-virtual bases just to avoid needing an excessive number of controlling flags, since otherwise I assume people might want a staging flag that disables this just for classes with bases.
Thanks for confirming. I've constructed https://godbolt.org/z/nKPfhPxsx which I believe demonstrates the problem there (we end up destroying `foobar` before `foo` or `bar` in the whole object destructor, so marking stores to `this` inside of `foobar` would change the behavior).
Given you said this is in general, it sounds like there are cases where virtual bases are not live out of the base subobject destructor?
https://github.com/llvm/llvm-project/pull/166276
More information about the cfe-commits
mailing list