[Bug c++/56373] -Wzero-as-null-pointer-constant: does not catch issues with smart pointers
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Feb 18 13:21:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56373
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-02-18 13:20:41 UTC ---
(In reply to comment #2)
> > It's necessary, because otherwise you get bogus warnings from ScopeGuard-style
> > RAII types.
>
> In which case the constructor and destructor would be meaningful,
> which is not the case here.
~shared_ptr() has non-trivial side-effects, the compiler isn't smart enough to
determine they won't fire when its empty, so it's always meaningful.
If you're smart enough to know the object isn't used then don't create it :)
More information about the Gcc-bugs
mailing list