-
-
Notifications
You must be signed in to change notification settings - Fork 264
Make lifetime extension explicit #156
Copy link
Copy link
Closed
Labels
Description
Thanks for creating such a cool tool!
It would be great if lifetime extension were made explicit. That is, the GOTW#88 const& behavior: https://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/
as in
struct C { virtual int get() const { return 0; } };
struct D : C { virtual int get() const override { return 1; } };
int foo() {
const C& c = D();
return c.get();
}
Right now the above produces
...
int foo()
{
const C & c = static_cast<const C&>(D());
return c.get();
}
which is correct, but the insight I'd like to see would show that after the return, c is destroyed with D::~D().
I'm not sure how you'd show that in the output, though... Maybe in a comment?
Reactions are currently unavailable