Commit a9a8d1d0 authored by Nathan Bronson's avatar Nathan Bronson Committed by Facebook Github Bot

silence false-positive compiler warning

Summary:
Add static casts near memcpy to silence a compiler warning
for a memcpy call site whose control flow is correctly guarded by the
appropriate type_traits check.

Reviewed By: yfeldblum, shixiao

Differential Revision: D13241617

fbshipit-source-id: 747b6cd1bb32c0971e805d1a4a9cdc5da6c73ea9
parent 6b1fb6fa
...@@ -1201,7 +1201,10 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -1201,7 +1201,10 @@ class VectorContainerPolicy : public BasePolicy<
auto origSrc = src; auto origSrc = src;
if (valueIsTriviallyCopyable()) { if (valueIsTriviallyCopyable()) {
std::memcpy(static_cast<void*>(dst), src, n * sizeof(Value)); std::memcpy(
static_cast<void*>(dst),
static_cast<void const*>(src),
n * sizeof(Value));
} else { } else {
for (std::size_t i = 0; i < n; ++i, ++src, ++dst) { for (std::size_t i = 0; i < n; ++i, ++src, ++dst) {
// TODO(T31574848): clean up assume-s used to optimize placement new // TODO(T31574848): clean up assume-s used to optimize placement new
...@@ -1227,7 +1230,10 @@ class VectorContainerPolicy : public BasePolicy< ...@@ -1227,7 +1230,10 @@ class VectorContainerPolicy : public BasePolicy<
Value* dst = std::addressof(values_[0]); Value* dst = std::addressof(values_[0]);
if (valueIsTriviallyCopyable()) { if (valueIsTriviallyCopyable()) {
std::memcpy(dst, src, size * sizeof(Value)); std::memcpy(
static_cast<void*>(dst),
static_cast<void const*>(src),
size * sizeof(Value));
} else { } else {
for (std::size_t i = 0; i < size; ++i, ++src, ++dst) { for (std::size_t i = 0; i < size; ++i, ++src, ++dst) {
try { try {
......
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