1 // Copyright (C) 2019 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // { dg-options "-DUSE_FILESYSTEM_TS -lstdc++fs" }
19 // { dg-do run { target c++11 } }
20 // { dg-require-filesystem-ts "" }
22 #include <experimental/filesystem>
24 #include <testsuite_hooks.h>
26 std::size_t bytes_allocated
= 0;
28 void* operator new(std::size_t n
)
31 return std::malloc(n
);
34 void operator delete(void* p
) noexcept
{ std::free(p
); }
35 #if __cpp_sized_deallocation
36 void operator delete(void* p
, std::size_t) noexcept
{ std::free(p
); }
42 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
44 std::wstring s1
= L
"/";
45 std::wstring s2
= L
"file";
46 std::wstring s3
= L
"C:";
47 std::wstring s4
= L
"\\";
51 std::string s2
= "file";
52 std::string s3
= "C:";
53 std::string s4
= "\\";
56 using std::experimental::filesystem::path
;
59 path p0
= std::move(s0
);
60 VERIFY( bytes_allocated
== 0 );
61 path p1
= std::move(s1
);
62 VERIFY( bytes_allocated
== 0 );
63 path p2
= std::move(s2
);
64 VERIFY( bytes_allocated
== 0 );
65 path p3
= std::move(s3
);
66 VERIFY( bytes_allocated
== 0 );
67 path p4
= std::move(s4
);
68 VERIFY( bytes_allocated
== 0 );