copy.pass.cpp 967 B

12345678910111213141516171819202122232425262728293031323334353637
  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. // UNSUPPORTED: c++98, c++03
  10. // <experimental/filesystem>
  11. // class path
  12. // path& operator=(path const&);
  13. #include <experimental/filesystem>
  14. #include <type_traits>
  15. #include <cassert>
  16. #include "test_macros.h"
  17. namespace fs = std::experimental::filesystem;
  18. int main() {
  19. using namespace fs;
  20. static_assert(std::is_copy_assignable<path>::value, "");
  21. static_assert(!std::is_nothrow_copy_assignable<path>::value, "should not be noexcept");
  22. const std::string s("foo");
  23. const path p(s);
  24. path p2;
  25. path& pref = (p2 = p);
  26. assert(p.native() == s);
  27. assert(p2.native() == s);
  28. assert(&pref == &p2);
  29. }