Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent compiler warning about writing to an object with no trivial copy-assignment #153

merged 1 commit into from Jul 18, 2019


Copy link

commented Jun 28, 2019

Fix sparetable part of #149.

The warnings are caused by differences between google::has_trivial_copy * google::has_trivial_destructor and std::is_trivially_copyable * std::is_trivially_destructible, henceforth referred to as google trivial and standard trivial.

In particularly, this causes warning in because

  1. If T and U are google trivial, pair<T, U> is also google trivial. However, pair is not standard trivial.
  2. HashObject is declared to be google trivial in explicitly even though it implements custom copy constructor and copy assignment.

This PR prevents the warnings by casting pointers to void* first before memcpy. This is fine as long as a google trivial type is really trivially copyable and destructible.


This comment has been minimized.

Copy link

commented Jul 18, 2019

@Dekken Would you please have a look at this and consider merging it?

@Dekken Dekken merged commit f93c0c6 into sparsehash:master Jul 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.