https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81250
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Right, we intentionally don't warn for unused variables with non-trivial destructors, because the destructor could be doing something useful (like logging that a scope was exited, or committing a "transaction" of some kind when leaving the scope). If the destructor does something then the object is "used", because whether it exists or not has side effects.