Consider: class A; void f0(A *a); void f1(A &a); void f2(A *a) { f1(a); } void f3(A &a) { f0(a); } We produce: t.cc:7:3: error: no matching function for call to 'f1' f1(a); ^~ t.cc:4:6: note: candidate function void f1(A &a); ^ t.cc:11:3: error: no matching function for call to 'f0' f0(a); ^~ t.cc:3:6: note: candidate function void f0(A *a); ^ In addition to producing a better error message for this common issue, it would be really nice to produce a fixit that ass a & or *. This is AKA rdar://7113438
*** Bug 9555 has been marked as a duplicate of this bug. ***
As of r158931, clang's error messages are better: $ cat tmp.cc class A; void f0(A *a); void f1(A &a); void f2(A *a) { f1(a); } void f3(A &a) { f0(a); } $ ./bin/clang -fsyntax-only tmp.cc tmp.cc:5:3: error: no matching function for call to 'f1' f1(a); ^~ tmp.cc:3:6: note: candidate function not viable: cannot convert argument of incomplete type 'A *' to 'A &' void f1(A &a); ^ tmp.cc:8:3: error: no matching function for call to 'f0' f0(a); ^~ tmp.cc:2:6: note: candidate function not viable: cannot convert argument of incomplete type 'A' to 'A *' void f0(A *a); ^ 2 errors generated. And if you change "class A;" to "class A {};": $ ./bin/clang -fsyntax-only tmp.cc tmp.cc:5:3: error: no matching function for call to 'f1' f1(a); ^~ tmp.cc:3:6: note: candidate function not viable: no known conversion from 'A *' to 'A &' for 1st argument; dereference the argument with * void f1(A &a); ^ tmp.cc:8:3: error: no matching function for call to 'f0' f0(a); ^~ tmp.cc:2:6: note: candidate function not viable: no known conversion from 'A' to 'A *' for 1st argument; take the address of the argument with & void f0(A *a); ^ 2 errors generated. The error message when A is an incomplete type could use a bit more love to make it more helpful like when A is a complete type, and there aren't any fix-it hints for any of the cases.
Created a patch submission here: http://reviews.llvm.org/D16949