cnstr.move.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright Louis Dionne 2013-2017
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  4. #include <boost/hana/bool.hpp>
  5. #include <boost/hana/fwd/hash.hpp>
  6. #include <boost/hana/set.hpp>
  7. #include <boost/hana/type.hpp>
  8. #include <support/constexpr_move_only.hpp>
  9. #include <support/tracked_move_only.hpp>
  10. #include <utility>
  11. namespace hana = boost::hana;
  12. constexpr bool in_constexpr_context() {
  13. auto t0 = hana::make_set(ConstexprMoveOnly<2>{}, ConstexprMoveOnly<3>{});
  14. auto t_implicit = std::move(t0);
  15. auto t_explicit(std::move(t_implicit));
  16. (void)t_implicit;
  17. (void)t_explicit;
  18. return true;
  19. }
  20. static_assert(in_constexpr_context(), "");
  21. int main() {
  22. {
  23. auto t0 = hana::make_set();
  24. auto t_implicit = std::move(t0);
  25. auto t_explicit(std::move(t_implicit));
  26. (void)t_explicit;
  27. (void)t_implicit;
  28. }
  29. {
  30. auto t0 = hana::make_set(TrackedMoveOnly<1>{});
  31. auto t_implicit = std::move(t0);
  32. auto t_explicit(std::move(t_implicit));
  33. (void)t_implicit;
  34. (void)t_explicit;
  35. }
  36. {
  37. auto t0 = hana::make_set(TrackedMoveOnly<1>{}, TrackedMoveOnly<2>{});
  38. auto t_implicit = std::move(t0);
  39. auto t_explicit(std::move(t_implicit));
  40. (void)t_implicit;
  41. (void)t_explicit;
  42. }
  43. {
  44. auto t0 = hana::make_set(TrackedMoveOnly<1>{}, TrackedMoveOnly<2>{}, TrackedMoveOnly<3>{});
  45. auto t_implicit = std::move(t0);
  46. auto t_explicit(std::move(t_implicit));
  47. (void)t_implicit;
  48. (void)t_explicit;
  49. }
  50. }