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