[libcxx-commits] [libcxx] 81cc834 - [libc++][test] Clean up libcxx/test/support/MoveOnly.h
Joe Loser via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jan 29 15:21:30 PST 2022
Author: Joe Loser
Date: 2022-01-29T18:20:46-05:00
New Revision: 81cc834a4801458698db79d0bf101390b0ecb7d6
URL: https://github.com/llvm/llvm-project/commit/81cc834a4801458698db79d0bf101390b0ecb7d6
DIFF: https://github.com/llvm/llvm-project/commit/81cc834a4801458698db79d0bf101390b0ecb7d6.diff
LOG: [libc++][test] Clean up libcxx/test/support/MoveOnly.h
Remove copy and copy assignment rather than have them as private declarations.
They are superfluous given the move and move assignment.
As a drive-by, also specialize `std::hash` without reopening `namespace std`.
Differential Revision: https://reviews.llvm.org/D118502
Added:
Modified:
libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp
libcxx/test/support/MoveOnly.h
Removed:
################################################################################
diff --git a/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp b/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp
index 3f3801c80e04f..4961fe52f3288 100644
--- a/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp
+++ b/libcxx/test/std/containers/sequences/array/array.creation/to_array.fail.cpp
@@ -28,14 +28,14 @@ int main(int, char**) {
{
MoveOnly mo[] = {MoveOnly{3}};
// expected-error at array:* {{to_array requires copy constructible elements}}
- // expected-error at array:* {{calling a private constructor}}
+ // expected-error at array:* {{call to implicitly-deleted copy constructor of 'MoveOnly'}}
std::to_array(mo); // expected-note {{requested here}}
}
{
const MoveOnly cmo[] = {MoveOnly{3}};
// expected-error at array:* {{to_array requires move constructible elements}}
- // expected-error at array:* {{calling a private constructor}}
+ // expected-error at array:* {{call to implicitly-deleted copy constructor of 'MoveOnly'}}
std::to_array(std::move(cmo)); // expected-note {{requested here}}
}
diff --git a/libcxx/test/support/MoveOnly.h b/libcxx/test/support/MoveOnly.h
index 9b099b8fc8d43..33557773e9195 100644
--- a/libcxx/test/support/MoveOnly.h
+++ b/libcxx/test/support/MoveOnly.h
@@ -18,9 +18,6 @@
class MoveOnly
{
- MoveOnly(const MoveOnly&);
- MoveOnly& operator=(const MoveOnly&);
-
int data_;
public:
constexpr MoveOnly(int data = 1) : data_(data) {}
@@ -53,18 +50,15 @@ class MoveOnly
friend void operator,(T t, U u) = delete;
};
-namespace std {
template <>
-struct hash<MoveOnly>
+struct std::hash<MoveOnly>
{
typedef MoveOnly argument_type;
typedef size_t result_type;
constexpr size_t operator()(const MoveOnly& x) const {return x.get();}
};
-}
-
#endif // TEST_STD_VER >= 11
#endif // MOVEONLY_H
More information about the libcxx-commits
mailing list