| 1 |
|
| 2 |
template <typename _Tp> |
| 3 |
struct Base |
| 4 |
{ |
| 5 |
// template constructor |
| 6 |
template<typename _Del> Base(_Tp *__p, _Del __d); |
| 7 |
}; |
| 8 |
|
| 9 |
template <typename _Tp, typename _Dp> |
| 10 |
struct Derived : Base<_Tp> |
| 11 |
{ |
| 12 |
// Inheriting the template constructor |
| 13 |
using Base<_Tp>::Base; |
| 14 |
}; |
| 15 |
|
| 16 |
template <typename _Tp> |
| 17 |
class unique_ptr |
| 18 |
{ |
| 19 |
Derived<_Tp, int> _M_t; |
| 20 |
|
| 21 |
public: |
| 22 |
// Instantiates Derived<ResultDerived,int>::Derived |
| 23 |
template<typename _Up> unique_ptr(unique_ptr<_Up>&& __u) noexcept |
| 24 |
: _M_t ((_Tp *)0, 1) { } |
| 25 |
}; |
| 26 |
|
| 27 |
struct ResultBase { }; |
| 28 |
struct ResultDerived : ResultBase { }; |
| 29 |
|
| 30 |
void Frob (unique_ptr<ResultBase> &&__res) ; |
| 31 |
|
| 32 |
inline void X (unique_ptr<ResultDerived> &parm) |
| 33 |
{ |
| 34 |
Frob (static_cast <unique_ptr<ResultDerived> &&> (parm)); |
| 35 |
} |