https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69139
--- Comment #3 from TC <rs2740 at gmail dot com> --- Another test case, slightly modified from the original in the linked SO question: struct X { auto get(int) const & -> int { return {}; } auto get(int) && -> long { return {}; } }; template <class R> auto f(auto (X::*)(int) const & -> R) -> R {} using I = decltype(f(&X::get)); using I = int; The fix needs to also handle the cv-qualifier-seq and ref-qualifier in the function type, if any.