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 10 // UNSUPPORTED: c++98, c++03 11 12 // <filesystem> 13 14 // class path 15 16 // path& operator=(path&&) noexcept 17 18 #include "filesystem_include.hpp" 19 #include <type_traits> 20 #include <cassert> 21 22 #include "test_macros.h" 23 #include "count_new.hpp" 24 25 main()26int main() { 27 using namespace fs; 28 static_assert(std::is_nothrow_move_assignable<path>::value, ""); 29 assert(globalMemCounter.checkOutstandingNewEq(0)); 30 const std::string s("we really really really really really really really " 31 "really really long string so that we allocate"); 32 assert(globalMemCounter.checkOutstandingNewEq(1)); 33 path p(s); 34 { 35 DisableAllocationGuard g; 36 path p2; 37 path& pref = (p2 = std::move(p)); 38 assert(p2.native() == s); 39 assert(p.native() != s); // Testing moved from state 40 assert(&pref == &p2); 41 } 42 } 43