The problem is best explained with a testcase:

struct A {};
struct B {};

struct S {
  void method(A*);
  void method(B*);
};

void test() {
  B b;
  S s;
  s.methodd(&b);
}

we currently typo-correct the "s.methodd" to "s.method" but refer to the
NamedDecl* for "void method(A*);" both in the note and when continuing to
parse. That in turn causes an extra diagnostics (can't convert B* to A*),
but worse in my mind is the fact that the parser isn't recovering as though
the suggested replacement text were applied.

Patch attached, now we recover by returning a LookupResult with all the
overload candidates found by looking up the typo-corrected name, and we
don't emit the note pointing to the previous decl(s) in case of overloaded
results. Please review closely, I'm not very familiar with this part of
clang.

Nick

Attachment: typo-member-expr-1.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to