https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102530
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> --- https://wg21.link/cwg900 and https://wg21.link/ewg120 deal with temporary lifetime issues with range-for. But they involve reference-like classes rather than C++ reference types; I suppose the warning also needs to consider reference/pointer-like classes.