From c68e140657e40cda2f027beff923276b36e33684 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 9 Apr 2010 00:35:39 +0000 Subject: Improve diagnostics when we fail to convert from a source type to a destination type for initialization, assignment, parameter-passing, etc. The main issue fixed here is that we used rather confusing wording for diagnostics such as t.c:2:9: warning: initializing 'char const [2]' discards qualifiers, expected 'char *' [-pedantic] char *name = __func__; ^ ~~~~~~~~ We're not initializing a 'char const [2]', we're initializing a 'char *' with an expression of type 'char const [2]'. Similar problems existed for other diagnostics in this area, so I've normalized them all with more precise descriptive text to say what we're initializing/converting/assigning/etc. from and to. The warning for the code above is now: t.c:2:9: warning: initializing 'char *' from an expression of type 'char const [2]' discards qualifiers [-pedantic] char *name = __func__; ^ ~~~~~~~~ Fixes . llvm-svn: 100832 --- clang/test/Sema/block-call.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/test/Sema/block-call.c') diff --git a/clang/test/Sema/block-call.c b/clang/test/Sema/block-call.c index 0aba75e14a9..01906bc4f2f 100644 --- a/clang/test/Sema/block-call.c +++ b/clang/test/Sema/block-call.c @@ -13,7 +13,7 @@ int main() { int (^IFP) () = PFR; // OK - const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int (^)()', expected 'int const (^)()'}} + const int (^CIC) () = IFP; // expected-error {{incompatible block pointer types initializing 'int const (^)()' from an expression of type 'int (^)()'}} const int (^CICC) () = CIC; @@ -21,7 +21,7 @@ int main() { int * const (^IPCC1) () = IPCC; - int * (^IPCC2) () = IPCC; // expected-error {{incompatible block pointer types initializing 'int *const (^)()', expected 'int *(^)()'}} + int * (^IPCC2) () = IPCC; // expected-error {{incompatible block pointer types initializing 'int *(^)()' from an expression of type 'int *const (^)()'}} int (^IPCC3) (const int) = PFR; @@ -29,14 +29,14 @@ int main() { int (^IPCC5) (int, char (^CArg) (double)) = IPCC4; - int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{incompatible block pointer types initializing 'int (^)(int, char (^)(double))', expected 'int (^)(int, char (^)(float))'}} + int (^IPCC6) (int, char (^CArg) (float)) = IPCC4; // expected-error {{incompatible block pointer types initializing 'int (^)(int, char (^)(float))' from an expression of type 'int (^)(int, char (^)(double))'}} IPCC2 = 0; - IPCC2 = 1; // expected-error {{invalid conversion assigning integer 'int', expected block pointer 'int *(^)()'}} + IPCC2 = 1; // expected-error {{invalid block pointer conversion assigning to 'int *(^)()' from 'int'}} int (^x)() = 0; - int (^y)() = 3; // expected-error {{invalid conversion initializing integer 'int', expected block pointer 'int (^)()'}} + int (^y)() = 3; // expected-error {{invalid block pointer conversion initializing 'int (^)()' from an expression of type 'int'}} int a = 1; - int (^z)() = a+4; // expected-error {{invalid conversion initializing integer 'int', expected block pointer 'int (^)()'}} + int (^z)() = a+4; // expected-error {{invalid block pointer conversion initializing 'int (^)()' from an expression of type 'int'}} } int blah() { -- cgit v1.2.3