Opened 9 years ago

Closed 9 years ago

#8894 closed Bugs (fixed)

shared_array cannot be constructed from a null pointer constant

Reported by: Jonathan Wakely <jwakely.boost@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

I would expect the following to compile:

#include <boost/shared_ptr.hpp>
#include <boost/shared_array.hpp>

int main()
{
    boost::shared_ptr<int>   p1(NULL);
    boost::shared_ptr<int[]> p2(NULL);
    boost::shared_array<int> p3(NULL);      // ERROR
#if __cplusplus >= 201103L
    boost::shared_ptr<int>   p4(nullptr);
    boost::shared_ptr<int[]> p5(nullptr);
    boost::shared_array<int> p6(nullptr);   // ERROR
#endif
}

With Boost 1.47 the shared_array initializations did compile with NULL and nullptr.

Change History (3)

comment:1 by Peter Dimov, 9 years ago

The shared_ptr initializations with NULL don't compile for me on a C++03 compiler.

comment:2 by anonymous, 9 years ago

Oops, sorry, I didn't actually check it in c++03!

comment:3 by Peter Dimov, 9 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.