https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103553
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-12-07 Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed, we do it for the template case but if it was not in a template we don't, notice: #include <type_traits> template<class T> class f { int && r; static_assert (std::is_same_v<decltype(r), int>,""); }; class f1 { int && r; static_assert (std::is_same_v<decltype(r), int>,""); }; void g () { int &&r = 42; f<decltype(r)> t; }