The attached is the proposed fix and test case for 5077.

I've discussed it for some time on IRC and it seems this is not a
perfect solution, however at this point I'm a bit stumped to find an
alternative and I figured I would get more results with mail list
discussions. The train of thought is the following:

 * Member initializers can accept one or more expressions which can
emit temporaries that need to be cleaned up.
   * Assuming expressions are correctly generated and use
EmitCXXExprWithTemporaries, can we assume that there can only be one
leftover temporary per argument?
 * The temporary needs to persist until after member constructor call.
 * CXXBaseOrMemberInitializer is not an Expr and cannot be wrapped
with EmitCXXExprWithTemporaries
 * (?) There should be no meaningful temporaries left after member
initializer completes.

Thus, we can do the same thing as in EmitCXXExprWithTemporaries , that
is perform a check right after member constructor completes and any
new live temporaries still kicking around are safe to dispose of.

Started nibbling on clang only a relatively short time ago, so
comments and guidance are much appreciated!

Cheers,


Dimitri.

Attachment: 5077.0.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to