https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115987
--- Comment #17 from Dan Urosu <durosu at yahoo dot com> --- I just tried something after you explained how this warning works. The most common cause of a real dangling ref is not caught unfortunately. If you replace the unwrap_1 impl with the below you get no warning. template <typename T> const T& unwrap_1(const Wrapper<T>& r) { Wrapper<T> r1(r); return r1.value(); // real dangling ref here! }