]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/filesystem/path/construct/90634.cc
1 // Copyright (C) 2019-2021 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 "-std=gnu++17" }
19 // { dg-do run { target c++17 } }
23 #include <testsuite_hooks.h>
25 std::size_t bytes_allocated
= 0;
27 void* operator new(std::size_t n
)
30 return std::malloc(n
);
33 void operator delete(void* p
) noexcept
{ std::free(p
); }
34 #if __cpp_sized_deallocation
35 void operator delete(void* p
, std::size_t) noexcept
{ std::free(p
); }
41 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
43 std::wstring s1
= L
"/";
44 std::wstring s2
= L
"///";
45 std::wstring s3
= L
"file";
46 std::wstring s4
= L
"C:";
47 std::wstring s5
= L
"\\";
51 std::string s2
= "///";
52 std::string s3
= "file";
53 std::string s4
= "C:";
54 std::string s5
= "\\";
57 using std::filesystem::path
;
60 path p0
= std::move(s0
);
61 VERIFY( bytes_allocated
== 0 );
62 path p1
= std::move(s1
);
63 VERIFY( bytes_allocated
== 0 );
64 path p2
= std::move(s2
);
65 VERIFY( bytes_allocated
== 0 );
66 path p3
= std::move(s3
);
67 VERIFY( bytes_allocated
== 0 );
68 path p4
= std::move(s4
);
69 VERIFY( bytes_allocated
== 0 );
70 path p5
= std::move(s5
);
71 VERIFY( bytes_allocated
== 0 );