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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Why should the compiler warn here? There are no resources being freed. Making
trivial copies and then destroying them is not a bug.

If you give the class some resources to manage (e.g. a pointer member) then
-Weffc++ will warn that you messed up:

dest.C:2:8: warning: ‘struct S’ has pointer data members [-Weffc++]
    2 | struct S {
      |        ^
dest.C:2:8: warning:   but does not declare ‘S(const S&)’ [-Weffc++]
dest.C:2:8: warning:   or ‘operator=(const S&)’ [-Weffc++]
dest.C:5:10: note: pointer member ‘S::p’ declared here
    5 |     int* p = nullptr;
      |          ^


It would be nice if you could turn on this warning without the rest of -Weffc++
but that's PR 16166.

Reply via email to