Implement LWG2433: uninitialized_copy()/etc. should tolerate overloaded operator&
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@237699 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/memory b/include/memory
index eb4a30f..4af72c3 100644
--- a/include/memory
+++ b/include/memory
@@ -3527,8 +3527,8 @@
try
{
#endif
- for (; __f != __l; ++__f, ++__r)
- ::new(&*__r) value_type(*__f);
+ for (; __f != __l; ++__f, (void) ++__r)
+ ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -3551,8 +3551,8 @@
try
{
#endif
- for (; __n > 0; ++__f, ++__r, --__n)
- ::new(&*__r) value_type(*__f);
+ for (; __n > 0; ++__f, (void) ++__r, (void) --__n)
+ ::new (static_cast<void*>(_VSTD::addressof(*__r))) value_type(*__f);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -3576,7 +3576,7 @@
{
#endif
for (; __f != __l; ++__f)
- ::new(&*__f) value_type(__x);
+ ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -3598,8 +3598,8 @@
try
{
#endif
- for (; __n > 0; ++__f, --__n)
- ::new(&*__f) value_type(__x);
+ for (; __n > 0; ++__f, (void) --__n)
+ ::new (static_cast<void*>(_VSTD::addressof(*__f))) value_type(__x);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)