get_rv.pass.cpp 893 B

12345678910111213141516171819202122232425262728293031323334
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // <tuple>
  9. // template <class... Types> class tuple;
  10. // template <size_t I, class... Types>
  11. // typename tuple_element<I, tuple<Types...> >::type&&
  12. // get(tuple<Types...>&& t);
  13. // UNSUPPORTED: c++98, c++03
  14. #include <tuple>
  15. #include <utility>
  16. #include <memory>
  17. #include <cassert>
  18. int main(int, char**)
  19. {
  20. {
  21. typedef std::tuple<std::unique_ptr<int> > T;
  22. T t(std::unique_ptr<int>(new int(3)));
  23. std::unique_ptr<int> p = std::get<0>(std::move(t));
  24. assert(*p == 3);
  25. }
  26. return 0;
  27. }