This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

### 881. `shared_ptr` conversion issue

Section: 20.11.3.2 [util.smartptr.shared.const] Status: C++11 Submitter: Peter Dimov Opened: 2008-08-30 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [util.smartptr.shared.const].

View all issues with C++11 status.

Discussion:

We've changed `shared_ptr<Y>` to not convert to `shared_ptr<T>` when `Y*` doesn't convert to `T*` by resolving issue 687. This only fixed the converting copy constructor though. N2351 later added move support, and the converting move constructor is not constrained.

[ San Francisco: ]

> We might be able to move this to NAD, Editorial once shared_ptr is conceptualized, but we want to revisit this issue to make sure.

[ 2009-07 Frankfurt ]

> Moved to Ready.

> This issue now represents the favored format for specifying constrained templates.

Proposed resolution:

We need to change the Requires clause of the move constructor:

>     shared_ptr(shared_ptr&& r);
>     template<class Y> shared_ptr(shared_ptr<Y>&& r);

> > Requires Remarks: For the second constructor `Y*` shall be convertible to `T*`. The second constructor shall not participate in overload resolution unless `Y*` is convertible to `T*`.

in order to actually make the example in 687 compile (it now resolves to the move constructor).