https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108165
--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> --- But even that won't work for Wdangling-reference6.C where the argtype is int but the rettype is std::pair<const int&, const int&>. Really, all I could do is to warn only when all the arguments to the function returning a reference are temporaries, e.g. don't warn on f(a, a); f(a, 42); f(42, a); only on f(42, 42);