[PATCH] D16949: Fix for: Bug 5941 - improve diagnostic for * vs & confusion

Ryan Yee via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 13 20:29:12 PST 2016


ryee88 updated this revision to Diff 47924.
ryee88 added a comment.

Added unit test as per review comments.


http://reviews.llvm.org/D16949

Files:
  test/Parser/overloaded-pointer-vs-reference-hint.cpp

Index: test/Parser/overloaded-pointer-vs-reference-hint.cpp
===================================================================
--- /dev/null
+++ test/Parser/overloaded-pointer-vs-reference-hint.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 %s -fsyntax-only -verify
+
+class A;
+
+void f0(A *a); // expected-note {{candidate function not viable: cannot convert argument of incomplete type 'A' to 'A *' for 1st argument; take the address of the argument with &}}
+void f1(A &a) {
+  f0(a); // expected-error {{no matching function for call to 'f0'}}
+}
+
+void f2(A &a); // expected-note {{candidate function not viable: cannot convert argument of incomplete type 'A *' to 'A &' for 1st argument; dereference the argument with *}}
+void f3(A *a) {
+  f2(a); // expected-error {{no matching function for call to 'f2'}}
+}
+
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16949.47924.patch
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160214/ad806df7/attachment.bin>


More information about the cfe-commits mailing list