]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/bufferlist: test move assignment operator not move constructor
authorChangcheng Liu <changcheng.liu@aliyun.com>
Sun, 10 May 2020 08:45:19 +0000 (16:45 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Tue, 12 May 2020 04:46:38 +0000 (12:46 +0800)
"bufferlist move = std::move(bl)" exercises the "move constructor".
But the purpose of this test is to verify the functionality of
"move assignment operator".
So this PR construct "move" first, and then assign rvalue reference to it.

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/test/bufferlist.cc

index 9a70e098ba61582467ce196229c55a5dc5a28d53..f73eec477283ffba5f0417d5b3fdd98d4fe8e8a0 100644 (file)
@@ -1412,7 +1412,8 @@ TEST(BufferList, operator_equal) {
   //
   // list& operator= (list&& other)
   //
-  bufferlist move = std::move(bl);
+  bufferlist move;
+  move = std::move(bl);
   {
     std::string dest;
     move.begin(1).copy(1, dest);