This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++17 status.
noexcept inshared_ptr::shared_ptr(nullptr_t)Section: 20.3.2.2[util.smartptr.shared]Status:C++17Submitter: Cassio NeriOpened: 2014-02-13Last modified: 2017-07-30
Priority:Not Prioritized
View all otherissues in [util.smartptr.shared].
View all issues withC++17 status.
Discussion:
The declaration and definition ofshared_ptr::shared_ptr(nullptr_t), given in 20.3.2.2[util.smartptr.shared], is
constexpr shared_ptr(nullptr_t) : shared_ptr() { }The intention seems clear: this constructor should have the same semantics of the default constructor. However, contrarily to the default constructor, this one is notnoexcept. In contrast,unique_ptr::unique_ptr(nullptr_t) isnoexcept, as per 20.3.1.3[unique.ptr.single]:
constexpr unique_ptr(nullptr_t) noexcept : unique_ptr() { }Both libstdc++ and libc++ have addednoexcept toshared_ptr::shared_ptr(nullptr_t). Microsoft's STL has not.
[2014-03-26 Library reflector vote]
The issue has been identified as Tentatively Ready based on six votes in favour.
Proposed resolution:
This wording is relative to N3936.
Change class templateshared_ptr synopsis, 20.3.2.2[util.smartptr.shared], as indicated:
constexpr shared_ptr(nullptr_t)noexcept : shared_ptr() { }