https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95911
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- As I noted in Bug 49974 comment 17, if you actually try to us the variable after it's been destroyed then GCC *does* warn. And if you use -fsanitize=address then you get an error at runtime.