https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64383
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paolo.carlini at oracle dot com --- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- According to http://gcc.godbolt.org/ g++ 4.8 used to warn, so this could be a regression. If we add a dummy foo() call to the dtor, so one could argue that it could be doing something useful, it doesn't change anything for g++4.8, 4.9 or clang. Is the dtor of Y actually called when the reference goes out of scope? That sounds strange to me. Note that no warning is given by clang or g++4.8 when y is not a reference.