We warn on this code, and variations of it, when gcc does not
struct Object {
int some_field;
Object() { memset(this, 0, sizeof(*this); }
Object(const Object&);
};
I put together a general set of the cases at https://godbolt.org/z/5YYj1oxf9
Basically performing these operations within constructors of a type, as long as the reason for the type not being trivially_{whatever} is just its own constructors, not due to the object being polymorphic or some sub- or baseobject being non-trivial to copy or initialize.