Skip to content

Commit 588aace

Browse files
committed
addressof
1 parent d0026cc commit 588aace

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

libcxx/include/__memory/array_cookie.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <__config>
1414
#include <__configuration/abi.h>
1515
#include <__cstddef/size_t.h>
16+
#include <__memory/addressof.h>
1617
#include <__type_traits/integral_constant.h>
1718
#include <__type_traits/is_trivially_destructible.h>
1819
#include <__type_traits/negation.h>
@@ -118,7 +119,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") size_t __get_array_cookie([
118119
_ArrayCookie __cookie;
119120
// This is necessary to avoid violating strict aliasing. It's valid because _ArrayCookie is an
120121
// implicit lifetime type.
121-
__builtin_memcpy(&__cookie, __allocation_start, sizeof(_ArrayCookie));
122+
__builtin_memcpy(std::addressof(__cookie), __allocation_start, sizeof(_ArrayCookie));
122123
return __cookie.__element_count;
123124
}
124125

0 commit comments

Comments
 (0)