https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77711
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- My patch doesn't help for comment 2 because we never call invalid_nonstatic_member_fn when the nonsense expression refers to the name of an overloaded member function. Instead we perform overload resolution hoping that one of the overloads will disambiguate a.foo, which will never happen. See Bug 50462 for a case very similar to comment 2 where we end up with over 200 lines of noise simply because don't stop as soon as we see an invalid member function call, and try to perform overload resolution on it instead.