Commit c8be4cb5 authored by Yin Qiu's avatar Yin Qiu Committed by Facebook Github Bot

Suppress class-memaccess warning with gcc 8.2 (#907)

Summary:
The following code won't compile with g++ 8.2 when `-Wall -Werror` is turned on (`-Werror=class-memaccess` implied):

    std::memcpy(dst, src, n * sizeof(Value))

where in `VectorContainerPolicy`'s case, `Value` is typically an `std::pair`, which  indeed has no trivial copy-assignment.
Pull Request resolved: https://github.com/facebook/folly/pull/907

Reviewed By: yfeldblum

Differential Revision: D9244951

Pulled By: Orvid

fbshipit-source-id: 26787d43dab7d4212c5975a509dfd8703b0a157c
parent 99ad09f9
......@@ -1148,7 +1148,7 @@ class VectorContainerPolicy : public BasePolicy<
complainUnlessNothrowMove<lift_unit_t<MappedTypeOrVoid>>();
if (valueIsTriviallyCopyable()) {
std::memcpy(dst, src, n * sizeof(Value));
std::memcpy(static_cast<void*>(dst), src, n * sizeof(Value));
} else {
for (std::size_t i = 0; i < n; ++i, ++src, ++dst) {
// TODO(T31574848): clean up assume-s used to optimize placement new
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment