// destructor
}
+// Try to avoid clang -Wself-move warnings from s1 = std::move(s1);
+template<typename T>
+void moveFrom(T &dest, T &src) {
+ dest = std::move(src);
+}
+
void LocalPointerTest::TestLocalPointerMoveSwap() {
UnicodeString *p1 = new UnicodeString((UChar)0x61);
UnicodeString *p2 = new UnicodeString((UChar)0x62);
// Move self assignment leaves the object valid but in an undefined state.
// Do it to make sure there is no crash,
// but do not check for any particular resulting value.
- s1 = std::move(s1);
- s3 = std::move(s3);
+ moveFrom(s1, s1);
+ moveFrom(s3, s3);
}
void LocalPointerTest::TestLocalPointerStdUniquePtr() {
// Move self assignment leaves the object valid but in an undefined state.
// Do it to make sure there is no crash,
// but do not check for any particular resulting value.
- a1 = std::move(a1);
- a3 = std::move(a3);
+ moveFrom(a1, a1);
+ moveFrom(a3, a3);
}
void LocalPointerTest::TestLocalArrayStdUniquePtr() {
// Move self assignment leaves the object valid but in an undefined state.
// Do it to make sure there is no crash,
// but do not check for any particular resulting value.
- f1 = std::move(f1);
- f3 = std::move(f3);
+ moveFrom(f1, f1);
+ moveFrom(f3, f3);
#endif /* !UCONFIG_NO_NORMALIZATION */
}
}
}
+// Try to avoid clang -Wself-move warnings from s1 = std::move(s1);
+void moveFrom(UnicodeString &dest, UnicodeString &src) {
+ dest = std::move(src);
+}
+
void
UnicodeStringTest::TestMoveSwap() {
static const UChar abc[3] = { 0x61, 0x62, 0x63 }; // "abc"
// Move self assignment leaves the object valid but in an undefined state.
// Do it to make sure there is no crash,
// but do not check for any particular resulting value.
- s1 = std::move(s1);
- s2 = std::move(s2);
- s3 = std::move(s3);
- s4 = std::move(s4);
- s5 = std::move(s5);
- s6 = std::move(s6);
- s7 = std::move(s7);
+ moveFrom(s1, s1);
+ moveFrom(s2, s2);
+ moveFrom(s3, s3);
+ moveFrom(s4, s4);
+ moveFrom(s5, s5);
+ moveFrom(s6, s6);
+ moveFrom(s7, s7);
// Simple copy assignment must work.
UnicodeString simple = UNICODE_STRING_SIMPLE("simple");
s1 = s6 = s4 = s7 = simple;