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