1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// UNSUPPORTED: c++98, c++03
11
12// <utility>
13
14// template <class T1, class T2> struct pair
15
16// template<class U, class V> pair& operator=(pair<U, V>&& p);
17
18#include <utility>
19#include <memory>
20#include <cassert>
21
22struct Base
23{
24    virtual ~Base() {}
25};
26
27struct Derived
28    : public Base
29{
30};
31
32int main()
33{
34    {
35        typedef std::pair<std::unique_ptr<Derived>, short> P1;
36        typedef std::pair<std::unique_ptr<Base>, long> P2;
37        P1 p1(std::unique_ptr<Derived>(), static_cast<short>(4));
38        P2 p2;
39        p2 = std::move(p1);
40        assert(p2.first == nullptr);
41        assert(p2.second == 4);
42    }
43}
44