Skip to content

Commit 04c2e79

Browse files
yfeldblumfacebook-github-bot
authored andcommitted
fix make_exception_ptr_with violation of warning class-memaccess under gcc-12
Summary: Fix this build failure: ``` folly/lang/Exception.cpp: In instantiation of ‘std::__exception_ptr::exception_ptr folly::detail::make_exception_ptr_from_rep_(Value) [with Value = void*]’: folly/lang/Exception.cpp:724:40: required from here folly/lang/Exception.cpp:707:14: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class std::__exception_ptr::exception_ptr’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess] 707 | std::memcpy(&ptr, &value, sizeof(value)); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/exception:168, from folly/lang/Exception.h:20, from folly/lang/Exception.cpp:17: /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/exception_ptr.h:90:11: note: ‘class std::__exception_ptr::exception_ptr’ declared here 90 | class exception_ptr | ^~~~~~~~~~~~~ ``` Reviewed By: dmm-fb Differential Revision: D76616506 fbshipit-source-id: 45bf3a716303e0efb6c22ee0f840c3b4ee5983d9
1 parent 05992d7 commit 04c2e79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

third-party/folly/src/folly/lang/Exception.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ static std::exception_ptr make_exception_ptr_from_rep_(Value value) noexcept {
704704
static_assert(sizeof(std::exception_ptr) == sizeof(Value));
705705
static_assert(alignof(std::exception_ptr) == alignof(Value));
706706
std::exception_ptr ptr;
707-
std::memcpy(&ptr, &value, sizeof(value));
707+
std::memcpy(static_cast<void*>(&ptr), &value, sizeof(value));
708708
return ptr;
709709
}
710710

0 commit comments

Comments
 (0)