Home Dashboard Directory Help
Search

C++ compiler NULL broken?? by Tom van Dijck


Status: 

Active


3
0
Sign in
to vote
Type: Bug
ID: 556348
Opened: 5/1/2010 9:32:08 PM
Access Restriction: Public
1
Workaround(s)
view
2
User(s) can reproduce this bug

Description

The following snippet does NOT compile...

#include "stdafx.h"
#include <vector>

int _tmain(int argc, _TCHAR* argv[])
{
    std::pair<int, const void*> mypair(0, NULL);
    return 0;
}



Details
Sign in to post a comment.
Posted by Microsoft on 11/1/2010 at 3:57 AM
Hi,

Thanks for reporting this bug. We've fixed it, by updating pair according to the latest C++0x Working Paper, and the fix will be available in VC11.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Pavel Minaev [MSFT] on 5/16/2010 at 12:20 PM
@Greg: I don't see it there. It mentions an std::pair of CComPtr, which is a different case altogether (that is concerned with implicit conversions).
Posted by GregM on 5/3/2010 at 7:44 AM
This case is specifically listed in the breaking changes document for VS2010.
http://msdn.microsoft.com/en-us/library/bb531344.aspx
Posted by Microsoft on 5/2/2010 at 4:09 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)
Posted by Pavel Minaev [MSFT] on 5/1/2010 at 11:26 PM
NULL isn't broken, but std::pair, apparently, is.

By the way, if you use nullptr rather than NULL, you'll avoid this issue.
Sign in to post a workaround.
Posted by Tom van Dijck on 5/1/2010 at 9:33 PM
#include "stdafx.h"
#include <vector>

int _tmain(int argc, _TCHAR* argv[])
{
    std::pair<int, const void*> mypair(0, (const void*)NULL);
    return 0;
}

But that requires a LOT of code upgrades throughout the world !!!