https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90196

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Максим Прохоренко from comment #3)
> Allocate GiB of unused memory and don't warn about it? But 1 simple double -
> it is a big problem.

Nobody said that. But the warning has to be driven by simple rules. An unused
double is easy to detect and warn about. Knowing if a complex type exists for
some reason that the compiler can't infer is harder to do.

> For std:: objects with side effect - OK!
> But for simple unused vector or set or map???

Destroying elements and deallocating memory is a side effect.

The compiler doesn't do arbitrarily complex analysis of what a destructor does,
it just considers a non-trivial destructor to be doing something.

Reply via email to