get_rv.pass.cpp 829 B

123456789101112131415161718192021222324252627282930
  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. // <array>
  10. // template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
  11. #include <array>
  12. #include <memory>
  13. #include <utility>
  14. #include <cassert>
  15. int main()
  16. {
  17. #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
  18. {
  19. typedef std::unique_ptr<double> T;
  20. typedef std::array<T, 1> C;
  21. C c = {std::unique_ptr<double>(new double(3.5))};
  22. T t = std::get<0>(std::move(c));
  23. assert(*t == 3.5);
  24. }
  25. #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
  26. }