diff options
| author | David Blaikie <dblaikie@gmail.com> | 2016-03-04 22:29:11 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2016-03-04 22:29:11 +0000 |
| commit | ac92893a93618d66416afbdd86db1ce99543e3e4 (patch) | |
| tree | c2bfb478e0ac9db8d8de75f4609c1d839c4fdc3c /clang/test | |
| parent | a0c9f6e73622e7f040d827850acbdfcbde945998 (diff) | |
| download | bcm5719-llvm-ac92893a93618d66416afbdd86db1ce99543e3e4.tar.gz bcm5719-llvm-ac92893a93618d66416afbdd86db1ce99543e3e4.zip | |
PR5941 - improve diagnostic for * vs & confusion when choosing overload candidate with a parameter of incomplete (ref or pointer) type
Reviewers: dblaikie
Differential Revision: http://reviews.llvm.org/D16949
llvm-svn: 262752
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/overload-call.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/clang/test/SemaCXX/overload-call.cpp b/clang/test/SemaCXX/overload-call.cpp index 3d286a94a04..7eaf98b601c 100644 --- a/clang/test/SemaCXX/overload-call.cpp +++ b/clang/test/SemaCXX/overload-call.cpp @@ -375,16 +375,24 @@ namespace test2 { } // PR 6117 -namespace test3 { - struct Base {}; +namespace IncompleteConversion { + struct Complete {}; struct Incomplete; - void foo(Base *); // expected-note 2 {{cannot convert argument of incomplete type}} - void foo(Base &); // expected-note 2 {{cannot convert argument of incomplete type}} - - void test(Incomplete *P) { - foo(P); // expected-error {{no matching function for call to 'foo'}} - foo(*P); // expected-error {{no matching function for call to 'foo'}} + void completeFunction(Complete *); // expected-note 2 {{cannot convert argument of incomplete type}} + void completeFunction(Complete &); // expected-note 2 {{cannot convert argument of incomplete type}} + + void testTypeConversion(Incomplete *P) { + completeFunction(P); // expected-error {{no matching function for call to 'completeFunction'}} + completeFunction(*P); // expected-error {{no matching function for call to 'completeFunction'}} + } + + void incompletePointerFunction(Incomplete *); // expected-note {{candidate function not viable: cannot convert argument of incomplete type 'IncompleteConversion::Incomplete' to 'IncompleteConversion::Incomplete *' for 1st argument; take the address of the argument with &}} + void incompleteReferenceFunction(Incomplete &); // expected-note {{candidate function not viable: cannot convert argument of incomplete type 'IncompleteConversion::Incomplete *' to 'IncompleteConversion::Incomplete &' for 1st argument; dereference the argument with *}} + + void testPointerReferenceConversion(Incomplete &reference, Incomplete *pointer) { + incompletePointerFunction(reference); // expected-error {{no matching function for call to 'incompletePointerFunction'}} + incompleteReferenceFunction(pointer); // expected-error {{no matching function for call to 'incompleteReferenceFunction'}} } } |

