[Meant to add this to the other email, but forgot to copy it back.] On 05/12/2017 03:31 AM, Martin Sebor wrote: > + // Zeroing out is diagnosed only because it's difficult not to. > + // Otherwise, a class that's non-trivial only because it has > + // a non-trivial dtor can be safely zeroed out (that's what > + // default-initializing it does).
FWIW, I found references like these to "default initialization" confusing, until I realized you're likely talking about default initialization in pre-C++11 terms. I.e., "new T()" with parens. I first assumed you're talking about default initialization like "new T;" or "T t;", but in that case the object would not the zeroed out, hence the confusion. It may be beneficial to go over the comments in the patch (and particularly documentation) and talk in C++11 (and later) terms -- i.e., say "value-initializing it" instead. > + T (bzero, (p, sizeof *p)); // { dg-warning "bzero" } > + T (memset, (p, 0, sizeof *p)); // { dg-warning "memset" } > + T (memset, (p, i, sizeof *p)); // { dg-warning "memset" } Thanks, Pedro Alves