Section: 22.214.171.124.2 [unique.ptr.single.ctor] Status: C++20 Submitter: Tim Song Opened: 2017-03-11 Last modified: 2021-02-25 10:48:01 UTC
View all other issues in [unique.ptr.single.ctor].
View all issues with C++20 status.
The wording simplification in LWG 2905 accidentally deleted the requirement that construction of the deleter doesn't throw an exception. While this isn't the end of the world since any exception will just run into the noexcept on the constructor and result in a call to std::terminate(), the other unique_ptr constructors still have a similar no-exception Requires: clause, leaving us in the odd situation where throwing an exception results in undefined behavior for some constructors and terminate() for others. If guaranteeing std::terminate() on exception is desirable, that should be done across the board.The proposed wording below simply restores the nothrow requirement along with the Copy/MoveConstructible requirement. Wording for the other alternative (guaranteed std::terminate()) can be produced if desired.
[2017-03-16, Daniel comments]
The publication of the new working draft is awaited, before proposed wording against that new working draft is formally possible.
[2017-05-03, Tim comments]
The suggested wording has been moved to the PR section now that the new working draft is available.
[2017-07 Toronto Wed Issue Prioritization]
Priority 0; Move to Ready
This wording is relative to N4659.
Insert a paragraph after 126.96.36.199.2 [unique.ptr.single.ctor] p11:
unique_ptr(pointer p, see below d1) noexcept; unique_ptr(pointer p, see below d2) noexcept;
-9- The signature of these constructors depends upon whether D is a reference type. If D is a non-reference type A, then the signatures are:[…] -10- If D is an lvalue reference type A&, then the signatures are: […] -11- If D is an lvalue reference type const A&, then the signatures are: […]