This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Cannot convert int (aka NULL) to std::vector<double*>::value_type
On 5 February 2013 10:20, Jonathan Wakely wrote:
> On 5 February 2013 10:15, Jonathan Wakely wrote:
>> On 5 February 2013 10:09, Jonathan Wakely wrote:
>>>> Is this a bug in the 4.7.1 compiler or did the compiler change to conform
>>>> to some standard that does not allow vector's to initialized to NULL.
>>>
>>> I don't think it changed in quite some time. It's a very well known
>>> problem, see http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#438,
>>> but the implementation is supposed to ensure it works. I can't
>>> remember if we have an open bug about it still.
>>
>> Looking into it further, I think we conform to C++ 2003 + DRs and the
>> workarounds given earlier are necessary.
>>
>> In C++ 2011 the implementation should accept the code, so we'll have
>> to fix that.
>
> This is the DR we don't implement yet:
> http://open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#1234
It's obviously too early in the morning for me, we've already fixed it
on the trunk:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43813
So it's an unfortunate defect in the C++ 2003 standard that the code
doesn't compile, but G++ is conforming to reject it. The C++ 2011
standard requires it to compile, and G++ 4.8 will accept it in C++11
mode.