get_rv.pass.cpp revision cd2254b454e9398d1287e44630f3ac654cf9f43c
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// <utility>
11
12// template <class T1, class T2> struct pair
13
14// template<size_t I, class T1, class T2>
15//     typename tuple_element<I, std::pair<T1, T2> >::type&&
16//     get(pair<T1, T2>&&);
17
18#include <utility>
19#include <memory>
20#include <cassert>
21
22int main()
23{
24#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
25    {
26        typedef std::pair<std::unique_ptr<int>, short> P;
27        P p(std::unique_ptr<int>(new int(3)), 4);
28        std::unique_ptr<int> ptr = std::get<0>(std::move(p));
29        assert(*ptr == 3);
30    }
31#endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
32}
33