diff --git a/libcxx/docs/Status/SpaceshipProjects.csv b/libcxx/docs/Status/SpaceshipProjects.csv --- a/libcxx/docs/Status/SpaceshipProjects.csv +++ b/libcxx/docs/Status/SpaceshipProjects.csv @@ -73,6 +73,7 @@ | `[time.zone.link.nonmembers] `_","| chrono::time_zone | chrono::leap_second | chrono::time_zone_link",A ```` implementation,Unassigned,|Not Started| +| `[fs.filesystem.syn] `_,| filesystem::space_info,None,Adrian Vogelsgesang,|Done| | `[fs.path.nonmember] `_,| filesystem::path,None,Unassigned,|Not Started| | `[fs.dir.entry.obs] `_,| filesystem::directory_entry,None,Unassigned,|Not Started| | `[re.submatch.op] `_,| sub_match,None,Unassigned,|Not Started| diff --git a/libcxx/include/__filesystem/space_info.h b/libcxx/include/__filesystem/space_info.h --- a/libcxx/include/__filesystem/space_info.h +++ b/libcxx/include/__filesystem/space_info.h @@ -28,6 +28,10 @@ uintmax_t capacity; uintmax_t free; uintmax_t available; + +# if _LIBCPP_STD_VER > 17 + friend bool operator==(const space_info&, const space_info&) = default; +# endif }; _LIBCPP_AVAILABILITY_FILESYSTEM_POP diff --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/space_info.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/space_info.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/space_info.pass.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// UNSUPPORTED: c++03, c++11, c++14, c++17 + +// + +// friend bool operator==(const space_info&, const space_info&); + +#include "filesystem_include.h" + +#include "test_macros.h" +#include "test_comparisons.h" + +using namespace fs; + +int main(int, char**) { + using space_info = std::filesystem::space_info; + + AssertEqualityAreNoexcept(); + AssertEqualityReturnBool(); + + assert(testEquality(space_info{1, 2, 3}, space_info{1, 2, 3}, true)); + assert(testEquality(space_info{0, 2, 3}, space_info{1, 2, 3}, false)); + assert(testEquality(space_info{1, 0, 3}, space_info{1, 2, 3}, false)); + assert(testEquality(space_info{1, 2, 0}, space_info{1, 2, 3}, false)); + + return 0; +}