New issue
Advanced search Search tips

Issue 833475 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
EstimatedDays: ----
NextAction: 2019-07-09
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Non-trivially-copyable types should not be trivially copied

Project Member Reported by a...@chromium.org, Apr 16 2018

Issue description

(For reference: https://groups.google.com/a/chromium.org/d/msg/cxx/ZSdlV-bpwiA/SsP_Qr1BCQAJ)

ListContainer::AppendByMoving and ContiguousContainer::AppendByMoving move objects with memcpy which is inappropriate for types that are not trivially-copyable.

This should be fixed, as Dana says, "It also looks like it should std::move() and call operator=(T&&), where the operator sets  is_tombstone_ = true on the T&&, instead of the memcpy-default-constructor dance."
 
As one of the culprits: at the time, I was sad that this was undefined behavior, but the real use cases involved types which are not trivially copyable/movable but in practice work (like scoped_refptr), and the performance difference was measurable.

I confess to not anticipating the interaction with gtest, but it should be fixable by having a simple object which would be safe to memcpy delegate to a "real" mock object elsewhere.

Any attempt to make this use only defined behavior (which I would be very very happy to lgtm) should take care to ensure it doesn't significantly regress cc or blink paint performance.
Labels: Pri-3
NextAction: 2019-07-09
Downgrading P2s that haven't been modified in more than 6 months, which have no component or owner.

Sign in to add a comment