Opened 9 years ago
Closed 9 years ago
#8894 closed Bugs (fixed)
shared_array cannot be constructed from a null pointer constant
| Reported by: | 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 , 9 years ago
comment:3 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

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