1f7b43230SLouis Dionne //===----------------------------------------------------------------------===//
2f7b43230SLouis Dionne //
3f7b43230SLouis Dionne // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4f7b43230SLouis Dionne // See https://llvm.org/LICENSE.txt for license information.
5f7b43230SLouis Dionne // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6f7b43230SLouis Dionne //
7f7b43230SLouis Dionne //===----------------------------------------------------------------------===//
8f7b43230SLouis Dionne 
931cbe0f2SLouis Dionne // UNSUPPORTED: c++03
10*3d405081SLouis Dionne 
11f7b43230SLouis Dionne // <filesystem>
12f7b43230SLouis Dionne 
13f7b43230SLouis Dionne // class path
14f7b43230SLouis Dionne 
15f7b43230SLouis Dionne // path(path&&) noexcept
16f7b43230SLouis Dionne 
17cc89063bSNico Weber #include "filesystem_include.h"
18fcc0964eSNikolas Klauser #include <cassert>
191d50cf98SNikolas Klauser #include <string>
201d50cf98SNikolas Klauser #include <type_traits>
21f7b43230SLouis Dionne 
22f7b43230SLouis Dionne #include "test_macros.h"
23cc89063bSNico Weber #include "count_new.h"
24f7b43230SLouis Dionne 
25f7b43230SLouis Dionne 
main(int,char **)26f7b43230SLouis Dionne int main(int, char**) {
27f7b43230SLouis Dionne   using namespace fs;
28f7b43230SLouis Dionne   static_assert(std::is_nothrow_move_constructible<path>::value, "");
29f7b43230SLouis Dionne   assert(globalMemCounter.checkOutstandingNewEq(0));
30f7b43230SLouis Dionne   const std::string s("we really really really really really really really "
31f7b43230SLouis Dionne                       "really really long string so that we allocate");
32128b2136SMartin Storsjö   ASSERT_WITH_LIBRARY_INTERNAL_ALLOCATIONS(
33128b2136SMartin Storsjö       globalMemCounter.checkOutstandingNewEq(1));
343784bdf2SMartin Storsjö   const fs::path::string_type ps(s.begin(), s.end());
35f7b43230SLouis Dionne   path p(s);
36f7b43230SLouis Dionne   {
37f7b43230SLouis Dionne     DisableAllocationGuard g;
38f7b43230SLouis Dionne     path p2(std::move(p));
393784bdf2SMartin Storsjö     assert(p2.native() == ps);
403784bdf2SMartin Storsjö     assert(p.native() != ps); // Testing moved from state
41f7b43230SLouis Dionne   }
42f7b43230SLouis Dionne 
43f7b43230SLouis Dionne   return 0;
44f7b43230SLouis Dionne }
45