Destructor of temporary object not executed - by Valentin Z

Status : 


Sign in
to vote
ID 785647 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 4/26/2013 1:55:52 AM
Access Restriction Public


If a temporary X is bound to a reference member in a constructor's ctor-intializer, the destructor of X is never executed.


struct A;

struct B {
	A const& a;
	B() : a(A()) {} // A::~A is not executed after constructor exits.
Sign in to post a comment.
Posted by Microsoft on 4/26/2013 at 3:15 AM
Thanks for your feedback. We have marked this bug as a duplicate of Feedback item 761742. Please see the issue linked to this bug for updates.

Thank you,
Microsoft Visual Studio Connect Support Team
Posted by Microsoft on 4/26/2013 at 2:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(
Posted by Valentin Z on 4/26/2013 at 2:24 AM
Just found out that the same problem has been reported before by Cassio Neri, see ID 761742.
Visual C++ Team says "The fix should show up in the next release of Visual C++".
Sorry for the inconvenience.