Index: tests/CPlusPlusEleven.cpp |
diff --git a/tests/CPlusPlusEleven.cpp b/tests/CPlusPlusEleven.cpp |
index b5a34b2264914e9c3b57d6115aa6068f45beab78..3130e6f95bd1edf99cdccd74b600e921abe68ab9 100644 |
--- a/tests/CPlusPlusEleven.cpp |
+++ b/tests/CPlusPlusEleven.cpp |
@@ -35,3 +35,23 @@ DEF_TEST(CPlusPlusEleven_constexpr, r) { |
static constexpr int y = SkTPin<int>(100, 0, 10); |
REPORTER_ASSERT(r, y == 10); |
} |
+ |
+namespace { |
+struct MoveableCopyable { |
+ bool fCopied; |
+ MoveableCopyable() : fCopied(false) {} |
+ MoveableCopyable(const MoveableCopyable &o) : fCopied(true) {} |
+ MoveableCopyable(MoveableCopyable &&o) : fCopied(o.fCopied) {} |
+}; |
+struct TestClass { |
+ MoveableCopyable fFoo; |
+}; |
+} // namespace |
+ |
+DEF_TEST(CPlusPlusEleven_default_move, r) { |
+ TestClass a; |
+ TestClass b(a); |
+ TestClass c(std::move(a)); |
+ REPORTER_ASSERT(r, b.fFoo.fCopied); |
+ REPORTER_ASSERT(r, !c.fFoo.fCopied); |
+} |