This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
unique_ptrSection: 20.3.1.3.4 [unique.ptr.single.asgn] Status: C++14 Submitter: Daniel Krügler Opened: 2011-04-16 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [unique.ptr.single.asgn].
View all issues with C++14 status.
Discussion:
The semantics described in 20.3.1.3.4 [unique.ptr.single.asgn] p. 6
Effects: Transfers ownership from
uto*thisas if […] followed by an assignment fromstd::forward<D>(u.get_deleter()).
contradicts to the pre-conditions described in p. 4:
Requires: If E is not a reference type, assignment of the deleter from an rvalue of type
Eshall be well-formed and shall not throw an exception. Otherwise,Eis a reference type and assignment of the deleter from an lvalue of typeEshall be well-formed and shall not throw an exception.
Either the pre-conditions are incorrect or the semantics should be an assignment from
std::forward<E>(u.get_deleter()), instead.
It turns out that this contradiction is due to an incorrect transcription from the proposed
resolution of 983(i) to the finally accepted proposal
n3073 (see
bullet 12) as confirmed by Howard Hinnant, thus the type argument provided to std::forward
must be fixed as indicated.
[Bloomington, 2011]
Move to Ready
Proposed resolution:
This wording is relative to the FDIS.
Edit 20.3.1.3.4 [unique.ptr.single.asgn] p. 6 as indicated:
template <class U, class E> unique_ptr& operator=(unique_ptr<U, E>&& u) noexcept;4 - Requires: If
5 - Remarks: This operator shall not participate in overload resolution unless:Eis not a reference type, assignment of the deleter from an rvalue of typeEshall be well-formed and shall not throw an exception. Otherwise,Eis a reference type and assignment of the deleter from an lvalue of typeEshall be well-formed and shall not throw an exception.
unique_ptr<U, E>::pointeris implicitly convertible topointerandUis not an array type.6 - Effects: Transfers ownership from
7 - Returns:uto*thisas if by callingreset(u.release())followed by an assignment fromstd::forward<.DE>(u.get_deleter())*this.