[cfe-commits] [libcxx] r131199 - in /libcxx/trunk: include/memory test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp

Howard Hinnant hhinnant at apple.com
Wed May 11 13:21:19 PDT 2011


Author: hhinnant
Date: Wed May 11 15:21:19 2011
New Revision: 131199

URL: http://llvm.org/viewvc/llvm-project?rev=131199&view=rev
Log:
Corrected some bugs in both memory and the tests.  Preparing for being able to turn on support for alias templates.

Modified:
    libcxx/trunk/include/memory
    libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
    libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=131199&r1=131198&r2=131199&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Wed May 11 15:21:19 2011
@@ -794,7 +794,7 @@
     typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
 
 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
-    template <class _Up> using rebind = __pointer_traits_rebind<pointer, _Up>::type;
+    template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
 #else
     template <class _Up> struct rebind
         {typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
@@ -1331,7 +1331,7 @@
 
 #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
     template <class _Tp> using rebind_alloc =
-                           __allocator_traits_rebind<allocator_type, _Tp>::type;
+                  typename __allocator_traits_rebind<allocator_type, _Tp>::type;
     template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp>>;
 #else  // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
     template <class _Tp> struct rebind_alloc
@@ -3338,7 +3338,7 @@
 shared_ptr<_Tp>&
 shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
 {
-    shared_ptr(__r).swap(*this);
+    shared_ptr(_STD::move(__r)).swap(*this);
     return *this;
 }
 

Modified: libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp?rev=131199&r1=131198&r2=131199&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/default.allocator/allocator.members/construct.pass.cpp Wed May 11 15:21:19 2011
@@ -64,7 +64,7 @@
 
 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     move_only(move_only&&) {++move_only_constructed;}
-    move_only& operator=(move_only&&) {}
+    move_only& operator=(move_only&&) {return *this;}
 #else  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     operator std::__rv<move_only> () {return std::__rv<move_only>(*this);}
     move_only(std::__rv<move_only>) {++move_only_constructed;}

Modified: libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp?rev=131199&r1=131198&r2=131199&view=diff
==============================================================================
--- libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp (original)
+++ libcxx/trunk/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp Wed May 11 15:21:19 2011
@@ -47,7 +47,7 @@
         A* ptrA = pA.get();
         {
             std::shared_ptr<B> pB(new B);
-            pB = pA;
+            pB = std::move(pA);
             assert(B::count == 1);
             assert(A::count == 1);
             assert(pB.use_count() == 1);
@@ -64,7 +64,7 @@
         A* ptrA = pA.get();
         {
             std::shared_ptr<B> pB(new B);
-            pB = pA;
+            pB = std::move(pA);
             assert(B::count == 0);
             assert(A::count == 0);
             assert(pB.use_count() == 1);
@@ -81,7 +81,7 @@
         A* ptrA = pA.get();
         {
             std::shared_ptr<B> pB;
-            pB = pA;
+            pB = std::move(pA);
             assert(B::count == 1);
             assert(A::count == 1);
             assert(pB.use_count() == 1);
@@ -98,7 +98,7 @@
         A* ptrA = pA.get();
         {
             std::shared_ptr<B> pB;
-            pB = pA;
+            pB = std::move(pA);
             assert(B::count == 0);
             assert(A::count == 0);
             assert(pB.use_count() == 1);





More information about the cfe-commits mailing list