Use something really explicit to test "move semantics" on builds without
authorChandler Carruth <chandlerc@gmail.com>
Sat, 9 Nov 2013 04:49:27 +0000 (04:49 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 9 Nov 2013 04:49:27 +0000 (04:49 +0000)
r-value references. I still want to test that when we have them,
llvm_move is actually a move.

Have I mentioned that I really want to move to C++11? ;]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194318 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ADT/polymorphic_ptr_test.cpp

index 90c3385c4f270d52e2d2dd06e8231bf980e7420b..ce001d1e309318db0abd49a8410185e802bcb3cc 100644 (file)
@@ -57,6 +57,10 @@ TEST(polymorphic_ptr_test, Basic) {
   EXPECT_EQ(42, p->x);
 
   polymorphic_ptr<S> p2((llvm_move(p)));
+#if !LLVM_HAS_RVALUE_REFERENCES
+  // 'p' may not have been moved from in C++98, fake it for the test.
+  p2 = p.take();
+#endif
   EXPECT_FALSE((bool)p);
   EXPECT_TRUE(!p);
   EXPECT_TRUE((bool)p2);