Home Dashboard Directory Help

C++11 std::unique_ptr cast to bool fails with deleter lambda by Slavik262


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 775810
Opened: 1/4/2013 8:29:14 AM
Access Restriction: Public
User(s) can reproduce this bug


When using a lambda as a deleter for std::unique_ptr, the unique_ptr ceases to cast to a bool correctly. The provided sample code compiles correctly in Visual Studio 2010, but fails to compile in Visual Studio 2012.

Also see http://stackoverflow.com/questions/12993335/c11-issues-when-moving-from-visual-studio-2010-to-2012
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:31 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Microsoft on 2/28/2013 at 3:59 PM

Thanks for reporting this bug. We've fixed it, and the fix will be available in VC12. (Note: VC8 = VS 2005, VC9 = VS 2008, VC10 = VS 2010, VC11 = VS 2012.)

We've implemented explicit operator bool() throughout the STL, which is immune to this bug that affected operator fake-bool().

Note: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
Posted by Microsoft on 1/6/2013 at 11:48 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/4/2013 at 8:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.