const_pair.pass.cpp 873 B

1234567891011121314151617181920212223242526272829303132333435
  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 <class U1, class U2>
  11. // tuple& operator=(const pair<U1, U2>& u);
  12. // UNSUPPORTED: c++98, c++03
  13. #include <tuple>
  14. #include <utility>
  15. #include <cassert>
  16. int main(int, char**)
  17. {
  18. {
  19. typedef std::pair<long, char> T0;
  20. typedef std::tuple<long long, short> T1;
  21. T0 t0(2, 'a');
  22. T1 t1;
  23. t1 = t0;
  24. assert(std::get<0>(t1) == 2);
  25. assert(std::get<1>(t1) == short('a'));
  26. }
  27. return 0;
  28. }