[libcxx-commits] [libcxx] efc494a - [libc++] Add missing test for std::hash<std::filesystem::path>
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 4 07:38:02 PDT 2023
Author: Louis Dionne
Date: 2023-05-04T10:37:53-04:00
New Revision: efc494aa4d84e120be5b36c4bc8127ff90958b25
URL: https://github.com/llvm/llvm-project/commit/efc494aa4d84e120be5b36c4bc8127ff90958b25
DIFF: https://github.com/llvm/llvm-project/commit/efc494aa4d84e120be5b36c4bc8127ff90958b25.diff
LOG: [libc++] Add missing test for std::hash<std::filesystem::path>
Differential Revision: https://reviews.llvm.org/D149696
Added:
libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
Modified:
libcxx/include/module.modulemap.in
libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 99907787132b8..45a22d9d4822a 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -877,7 +877,11 @@ module std [system] {
module file_type { private header "__filesystem/file_type.h" }
module filesystem_error { private header "__filesystem/filesystem_error.h" }
module operations { private header "__filesystem/operations.h" }
- module path { private header "__filesystem/path.h" }
+ module path {
+ private header "__filesystem/path.h"
+ export functional.__functional.hash
+ export functional.__functional.unary_function
+ }
module path_iterator { private header "__filesystem/path_iterator.h" }
module perm_options { private header "__filesystem/perm_options.h" }
module perms { private header "__filesystem/perms.h" }
diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
index 504616c106652..e1d78de670475 100644
--- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.compare.pass.cpp
@@ -25,6 +25,7 @@
// strong_ordering operator<=>(path const&, path const&) noexcept;
//
// size_t hash_value(path const&) noexcept;
+// template<> struct hash<filesystem::path>;
#include "filesystem_include.h"
#include <type_traits>
diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
new file mode 100644
index 0000000000000..bc1db879f03e3
--- /dev/null
+++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.hash_enabled.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <filesystem>
+
+// Test that <filesystem> provides all of the arithmetic, enum, and pointer
+// hash specializations.
+
+#include "filesystem_include.h"
+#include "poisoned_hash_helper.h"
+
+int main(int, char**) {
+ test_library_hash_specializations_available();
+ test_hash_enabled_for_type<fs::path>();
+
+ return 0;
+}
More information about the libcxx-commits
mailing list