https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98283
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords| |accepts-invalid Last reconfirmed| |2021-08-03 Summary|decltype(auto) may deduce a |decltype(auto) may deduce a |static data member to wrong |static data member to wrong |type |type in a template --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Reduced testcase that is accepted but should not be: struct TestSkip { static int unused; }; template <class T> struct FIELD { TestSkip *obj; decltype(auto) value() { return (obj->unused); } }; int main() { TestSkip s; int sf; int i; decltype((FIELD<int>().value())) b; } Confirmed.