Skip to content

Commit a5716c4

Browse files
committed
Fix invalid casts
1 parent 4b85f6f commit a5716c4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libcxx/include/__functional/function.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> {
212212

213213
_LIBCPP_HIDE_FROM_ABI __default_alloc_func* __clone() const {
214214
using _Self = __default_alloc_func;
215-
unique_ptr<_Self, __deallocating_deleter<_Self>> __hold =
216-
std::__libcpp_allocate<_Self>(sizeof(_Self), _LIBCPP_ALIGNOF(_Self));
215+
unique_ptr<_Self, __deallocating_deleter<_Self>> __hold(
216+
static_cast<_Self*>(std::__libcpp_allocate<_Self>(sizeof(_Self), _LIBCPP_ALIGNOF(_Self))));
217217
_Self* __res = ::new ((void*)__hold.get()) _Self(__f_);
218218
(void)__hold.release();
219219
return __res;
@@ -669,8 +669,8 @@ class __policy_func<_Rp(_ArgTypes...)> {
669669
if (__use_small_storage<_Fun>()) {
670670
::new ((void*)&__buf_.__small) _Fun(std::move(__f));
671671
} else {
672-
unique_ptr<_Fun, __deallocating_deleter<_Fun>> __hold =
673-
std::__libcpp_allocate<_Fun>(sizeof(_Fun), _LIBCPP_ALIGNOF(_Fun));
672+
unique_ptr<_Fun, __deallocating_deleter<_Fun>> __hold(
673+
static_cast<_Fun*>(std::__libcpp_allocate<_Fun>(sizeof(_Fun), _LIBCPP_ALIGNOF(_Fun))));
674674
__buf_.__large = ::new ((void*)__hold.get()) _Fun(std::move(__f));
675675
(void)__hold.release();
676676
}

0 commit comments

Comments
 (0)