-
Fix handling Memset<> assignment and comparison · 1885f694Nicolas Capens authored
Previously the compiler would implicitly declare a copy constructor and assignment operator for classes derived from Memset<>, if they didn't have user-defined ones. This can cause them to have uninitialized padding bytes. By defining them ourselves using memcpy() we can ensure they're zero-initialized. Also define equality and less-than operators. The latter makes classes derived from Memset<> suitable as std::map<> keys. is_memcmparable<> now no longer works on classed derived from Memset<>, because it uses std::is_trivially_copyable<> which isn't true when a user-defined copy constructor or assignment operator is provided. Instead just rely on Memset<>'s new equality operators. Bug: b/131246679 Change-Id: I6e4963db8186955d8d3d3ef356fa42ef6a024c64 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42728 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Reviewed-by:
Antonio Maiorano <amaiorano@google.com> Tested-by:
Nicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
1885f694
×