In response to bug #20362, change the order of operations in vector move assignment...
authorMarshall Clow <mclow.lists@gmail.com>
Mon, 21 Jul 2014 15:11:13 +0000 (15:11 +0000)
committerMarshall Clow <mclow.lists@gmail.com>
Mon, 21 Jul 2014 15:11:13 +0000 (15:11 +0000)
llvm-svn: 213546

libcxx/include/vector

index 2cc23e5..d370214 100644 (file)
@@ -1331,10 +1331,10 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
     _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
 {
     deallocate();
+    __base::__move_assign_alloc(__c); // this can throw
     this->__begin_ = __c.__begin_;
     this->__end_ = __c.__end_;
     this->__end_cap() = __c.__end_cap();
-    __base::__move_assign_alloc(__c);
     __c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
 #if _LIBCPP_DEBUG_LEVEL >= 2
     __get_db()->swap(this, &__c);