Fix base::is_trivially_copyable to detect destructors.
std::is_trivially_copyable should return false for classes with nontrivial destructors. C++11 standard section 9.6 says a trivially copyable class is a class that: — has no non-trivial copy constructors (12.8), — has no non-trivial move constructors (12.8), — has no non-trivial copy assignment operators (13.5.3, 12.8), — has no non-trivial move assignment operators (13.5.3, 12.8), and — has a trivial destructor (12.4). The current implementation for _GNUC_VER < 501 didn't detech the destructor case. This is important because when is_trivially_copyable returns true, container code may implement moves as memcpy, when in fact it needs to me a memcpy + a destructor. Bug: Change-Id: I5739856ca7eaf5ddcf3eeb716bdc2dc33b0de0f2 Reviewed-on: https://chromium-review.googlesource.com/575020Reviewed-by:Daniel Cheng <dcheng@chromium.org> Commit-Queue: Brett Wilson <brettw@chromium.org> Cr-Commit-Position: refs/heads/master@{#487237}
Showing
Please register or sign in to comment