copy_assign_pass.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // Copyright (C) 2011 Vicente J. Botet Escriba
  10. //
  11. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  12. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  13. // <boost/thread/future.hpp>
  14. // class shared_future<R>
  15. // shared_future& operator=(const shared_future&);
  16. #define BOOST_THREAD_VERSION 3
  17. #include <boost/thread/future.hpp>
  18. #include <boost/detail/lightweight_test.hpp>
  19. int main()
  20. {
  21. {
  22. typedef int T;
  23. boost::promise<T> p;
  24. boost::shared_future<T> f0((p.get_future()));
  25. boost::shared_future<T> f;
  26. f = f0;
  27. BOOST_TEST(f0.valid());
  28. BOOST_TEST(f.valid());
  29. }
  30. {
  31. typedef int T;
  32. boost::shared_future<T> f0;
  33. boost::shared_future<T> f;
  34. f = f0;
  35. BOOST_TEST(!f0.valid());
  36. BOOST_TEST(!f.valid());
  37. }
  38. {
  39. typedef int& T;
  40. boost::promise<T> p;
  41. boost::shared_future<T> f0((p.get_future()));
  42. boost::shared_future<T> f;
  43. f = f0;
  44. BOOST_TEST(f0.valid());
  45. BOOST_TEST(f.valid());
  46. }
  47. {
  48. typedef int& T;
  49. boost::shared_future<T> f0;
  50. boost::shared_future<T> f;
  51. f = f0;
  52. BOOST_TEST(!f0.valid());
  53. BOOST_TEST(!f.valid());
  54. }
  55. {
  56. typedef void T;
  57. boost::promise<T> p;
  58. boost::shared_future<T> f0((p.get_future()));
  59. boost::shared_future<T> f;
  60. f = f0;
  61. BOOST_TEST(f0.valid());
  62. BOOST_TEST(f.valid());
  63. }
  64. {
  65. typedef void T;
  66. boost::shared_future<T> f0;
  67. boost::shared_future<T> f;
  68. f = f0;
  69. BOOST_TEST(!f0.valid());
  70. BOOST_TEST(!f.valid());
  71. }
  72. return boost::report_errors();
  73. }
  74. //#include "../../../remove_error_code_unused_warning.hpp"