diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-05-15 06:21:54 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-05-15 06:21:54 +0000 |
commit | d72da1513aa92aa47066c7aa498d987d2ae559ea (patch) | |
tree | 5474f1b7420e98ed8b013dcc41980613aba6818a /clang/test | |
parent | 8e4a3868fec3664125d82093ed13303ff368285b (diff) | |
download | bcm5719-llvm-d72da1513aa92aa47066c7aa498d987d2ae559ea.tar.gz bcm5719-llvm-d72da1513aa92aa47066c7aa498d987d2ae559ea.zip |
Further improvement to wording of overload resolution diagnostics, and including
the sole parameter name in the diagnostic in more cases. Patch by Terry Long!
llvm-svn: 156807
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Sema/exprs.c | 9 | ||||
-rw-r--r-- | clang/test/SemaCXX/default1.cpp | 9 | ||||
-rw-r--r-- | clang/test/SemaCXX/overload-call.cpp | 6 | ||||
-rw-r--r-- | clang/test/SemaCXX/overload-member-call.cpp | 8 |
4 files changed, 21 insertions, 11 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c index 8bedd6dd01a..a93e12ec390 100644 --- a/clang/test/Sema/exprs.c +++ b/clang/test/Sema/exprs.c @@ -165,14 +165,17 @@ void test17(int x) { // PR6501 & PR11857 void test18_a(int a); // expected-note 2 {{'test18_a' declared here}} void test18_b(int); // expected-note {{'test18_b' declared here}} -void test18_c(int a, int b); // expected-note {{'test18_c' declared here}} +void test18_c(int a, int b); // expected-note 2 {{'test18_c' declared here}} void test18_d(int a, ...); // expected-note {{'test18_d' declared here}} +void test18_e(int a, int b, ...); // expected-note {{'test18_e' declared here}} void test18(int b) { - test18_a(b, b); // expected-error {{too many arguments to function call, expected 1, have 2}} - test18_a(); // expected-error {{too few arguments to function call, argument 'a' was not specified}} + test18_a(b, b); // expected-error {{too many arguments to function call, expected single argument 'a', have 2}} + test18_a(); // expected-error {{too few arguments to function call, single argument 'a' was not specified}} test18_b(); // expected-error {{too few arguments to function call, expected 1, have 0}} test18_c(b); // expected-error {{too few arguments to function call, expected 2, have 1}} + test18_c(b, b, b); // expected-error {{too many arguments to function call, expected 2, have 3}} test18_d(); // expected-error {{too few arguments to function call, at least argument 'a' must be specified}} + test18_e(); // expected-error {{too few arguments to function call, expected at least 2, have 0}} } // PR7569 diff --git a/clang/test/SemaCXX/default1.cpp b/clang/test/SemaCXX/default1.cpp index a911e20b12a..c8c197e153d 100644 --- a/clang/test/SemaCXX/default1.cpp +++ b/clang/test/SemaCXX/default1.cpp @@ -47,6 +47,13 @@ int i () { void j (int f = 4); { void j (int f); // expected-note{{'j' declared here}} - j(); // expected-error{{too few arguments to function call, argument 'f' was not specified}} + j(); // expected-error{{too few arguments to function call, single argument 'f' was not specified}} + } +} + +int i2() { + void j(int f = 4); // expected-note{{'j' declared here}} + { + j(2, 3); // expected-error{{too many arguments to function call, expected at most single argument 'f', have 2}} } } diff --git a/clang/test/SemaCXX/overload-call.cpp b/clang/test/SemaCXX/overload-call.cpp index db994441ab7..09eb71d36d7 100644 --- a/clang/test/SemaCXX/overload-call.cpp +++ b/clang/test/SemaCXX/overload-call.cpp @@ -324,9 +324,9 @@ namespace test1 { void foo(int n, const char *s, int t, int u = 0); // expected-note {{candidate function not viable: requires at least 3 arguments, but 2 were provided}} // PR 11857 - void foo(int n); // expected-note {{candidate function not viable: requires argument 'n', but 2 were provided}} - void foo(unsigned n = 10); // expected-note {{candidate function not viable: requires at most argument 'n', but 2 were provided}} - void bar(int n, int u = 0); // expected-note {{candidate function not viable: requires at least argument 'n', but none were provided}} + void foo(int n); // expected-note {{candidate function not viable: requires single argument 'n', but 2 arguments were provided}} + void foo(unsigned n = 10); // expected-note {{candidate function not viable: allows at most single argument 'n', but 2 arguments were provided}} + void bar(int n, int u = 0); // expected-note {{candidate function not viable: requires at least argument 'n', but no arguments were provided}} void baz(int n = 0, int u = 0); // expected-note {{candidate function not viable: requires at most 2 arguments, but 3 were provided}} void test() { diff --git a/clang/test/SemaCXX/overload-member-call.cpp b/clang/test/SemaCXX/overload-member-call.cpp index 31dac19a124..09586201e56 100644 --- a/clang/test/SemaCXX/overload-member-call.cpp +++ b/clang/test/SemaCXX/overload-member-call.cpp @@ -83,10 +83,10 @@ namespace test1 { void baz(int i); // expected-note {{candidate function not viable: no known conversion from 'const test1::A' to 'int' for 1st argument}} // PR 11857 - void foo(int n); // expected-note {{candidate function not viable: requires argument 'n', but 2 were provided}} - void foo(unsigned n = 10); // expected-note {{candidate function not viable: requires at most argument 'n', but 2 were provided}} - void rab(double n, int u = 0); // expected-note {{candidate function not viable: requires at least argument 'n', but none were provided}} - void rab(int n, int u = 0); // expected-note {{candidate function not viable: requires at least argument 'n', but none were provided}} + void foo(int n); // expected-note {{candidate function not viable: requires single argument 'n', but 2 arguments were provided}} + void foo(unsigned n = 10); // expected-note {{candidate function not viable: allows at most single argument 'n', but 2 arguments were provided}} + void rab(double n, int u = 0); // expected-note {{candidate function not viable: requires at least argument 'n', but no arguments were provided}} + void rab(int n, int u = 0); // expected-note {{candidate function not viable: requires at least argument 'n', but no arguments were provided}} void zab(double n = 0.0, int u = 0); // expected-note {{candidate function not viable: requires at most 2 arguments, but 3 were provided}} void zab(int n = 0, int u = 0); // expected-note {{candidate function not viable: requires at most 2 arguments, but 3 were provided}} }; |