Title
default_delete converting constructor underspecified
Status
c++11
Section
[unique.ptr.dltr.dflt]
Submitter
Howard Hinnant

Created on 2008-06-18.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Add after [unique.ptr.dltr.dflt], p1:

template <class U> default_delete(const default_delete<U>& other);

-1- Effects: ...

Remarks: This constructor shall participate in overload resolution if and only if U* is implicitly convertible to T*.

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Move to Ready.

Date: 2009-07-26.00:00:00

[ 2009-07-26 Howard provided rewritten proposed wording and moved to Review. ]

Date: 2010-10-21.18:28:33

[ 2009-07 Frankfurt: ]

The proposed resolution uses concepts. Howard needs to rewrite the proposed resolution.

Move back to Open.

Date: 2010-10-21.18:28:33

[ Batavia (2009-05): ]

Keep in Review status for the reasons cited.

Date: 2010-10-21.18:28:33

[ Post Summit: ]

Alisdair: This issue has to stay in review pending a paper constraining unique_ptr.

Consensus: We agree with the resolution, but unique_ptr needs to be constrained, too.

Recommend Keep in Review.

Date: 2010-10-21.18:28:33

[ Howard adds 2008-11-26: ]

I believe we need to be careful to not outlaw the following use case, and I believe the current proposed wording (requires Convertible<U*, T*> && HasVirtualDestructor<T>) does so:

#include <memory>

int main()
{
    std::unique_ptr<int> p1(new int(1));
    std::unique_ptr<const int> p2(move(p1));
    int i = *p2;
//    *p2 = i;  // should not compile
}

I've removed "&& HasVirtualDestructor<T>" from the requires clause in the proposed wording.

Date: 2008-06-18.00:00:00

No relationship between U and T in the converting constructor for default_delete template.

Requirements: U* is convertible to T* and has_virtual_destructor<T>; the latter should also become a concept.

Rules out cross-casting.

The requirements for unique_ptr conversions should be the same as those on the deleter.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg4065
2010-10-21 18:28:33adminsetmessages: + msg4064
2010-10-21 18:28:33adminsetmessages: + msg4063
2010-10-21 18:28:33adminsetmessages: + msg4062
2010-10-21 18:28:33adminsetmessages: + msg4061
2010-10-21 18:28:33adminsetmessages: + msg4060
2010-10-21 18:28:33adminsetmessages: + msg4059
2008-06-18 00:00:00admincreate