* include/bits/allocated_ptr.h (__allocated_ptr): Use __addressof.
authorJonathan Wakely <jwakely@redhat.com>
Tue, 16 Jun 2015 22:33:06 +0000 (23:33 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 16 Jun 2015 22:33:06 +0000 (23:33 +0100)
From-SVN: r224540

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/allocated_ptr.h

index e6ed6ab168951c00cfdee5a30433da3427fd0fea..a9ed2064aeac2a7714cd3758a2372cc723578803 100644 (file)
@@ -1,5 +1,7 @@
 2015-06-16  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/bits/allocated_ptr.h (__allocated_ptr): Use __addressof.
+
        * include/bits/list.tcc (list::operator=(const list&), list::merge):
        Use __addressof instead of operator&.
        (list::sort): Use array-to-pointer decay instead of operator&.
index 63088c22d80d697ed5f93a36329f014748220d92..d7f00d706308a83ef3cbfcf713f8c5553287f972 100644 (file)
@@ -50,14 +50,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       /// Take ownership of __ptr
       __allocated_ptr(_Alloc& __a, pointer __ptr) noexcept
-      : _M_alloc(&__a), _M_ptr(__ptr)
+      : _M_alloc(std::__addressof(__a)), _M_ptr(__ptr)
       { }
 
       /// Convert __ptr to allocator's pointer type and take ownership of it
       template<typename _Ptr,
               typename _Req = _Require<is_same<_Ptr, value_type*>>>
       __allocated_ptr(_Alloc& __a, _Ptr __ptr)
-      : _M_alloc(&__a), _M_ptr(pointer_traits<pointer>::pointer_to(*__ptr))
+      : _M_alloc(std::__addressof(__a)),
+       _M_ptr(pointer_traits<pointer>::pointer_to(*__ptr))
       { }
 
       /// Transfer ownership of the owned pointer