get_rv.pass.cpp 919 B

123456789101112131415161718192021222324252627282930313233343536
  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. #include "test_macros.h"
  19. int main(int, char**)
  20. {
  21. {
  22. typedef std::tuple<std::unique_ptr<int> > T;
  23. T t(std::unique_ptr<int>(new int(3)));
  24. std::unique_ptr<int> p = std::get<0>(std::move(t));
  25. assert(*p == 3);
  26. }
  27. return 0;
  28. }