[libcxx] r249458 - Our test allocators support move/copy construction; they should support move/copy assignment as well

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 6 13:30:56 PDT 2015


Author: marshall
Date: Tue Oct  6 15:30:56 2015
New Revision: 249458

URL: http://llvm.org/viewvc/llvm-project?rev=249458&view=rev
Log:
Our test allocators support move/copy construction; they should support move/copy assignment as well

Modified:
    libcxx/trunk/test/support/allocators.h

Modified: libcxx/trunk/test/support/allocators.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/allocators.h?rev=249458&r1=249457&r2=249458&view=diff
==============================================================================
--- libcxx/trunk/test/support/allocators.h (original)
+++ libcxx/trunk/test/support/allocators.h Tue Oct  6 15:30:56 2015
@@ -35,6 +35,8 @@ public:
 
     A1(const A1& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
     A1(A1&& a)      TEST_NOEXCEPT : id_(a.id()) {move_called = true;}
+    A1& operator=(const A1& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
+    A1& operator=(A1&& a)      TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
 
     template <class U>
         A1(const A1<U>& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
@@ -96,6 +98,8 @@ public:
 
     A2(const A2& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
     A2(A2&& a)      TEST_NOEXCEPT : id_(a.id()) {move_called = true;}
+    A2& operator=(const A2& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
+    A2& operator=(A2&& a)      TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
 
     T* allocate(std::size_t n, const void* hint)
     {
@@ -142,7 +146,9 @@ public:
     static bool destroy_called;
 
     A3(const A3& a) TEST_NOEXCEPT : id_(a.id()) {copy_called = true;}
-    A3(A3&& a)      TEST_NOEXCEPT: id_(a.id())  {move_called = true;}
+    A3(A3&& a)      TEST_NOEXCEPT : id_(a.id())  {move_called = true;}
+    A3& operator=(const A3& a) TEST_NOEXCEPT { id_ = a.id(); copy_called = true; return *this;}
+    A3& operator=(A3&& a)      TEST_NOEXCEPT { id_ = a.id(); move_called = true; return *this;}
 
     template <class U, class ...Args>
     void construct(U* p, Args&& ...args)




More information about the cfe-commits mailing list