https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107889
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to David Mazières from comment #0) > A similar problem was reported in bug #59766 for friend functions returning > auto. That's unrelated. The problem here is that decltype(auto)::f is a nested-name-specifier for a member 'f' so is parsed as part of the return type, not the function name. This is what C++20 (and all earlier standards) said. The ambiguity has been resolved as a DR against earlier standards, but GCC doesn't implement that change yet, as shown at https://gcc.gnu.org/projects/cxx-status.html#cxx23