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/conditional.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'clang/test/Sema/conditional.c') diff --git a/clang/test/Sema/conditional.c b/clang/test/Sema/conditional.c index c3dbe1321b6..3d7bccaf975 100644 --- a/clang/test/Sema/conditional.c +++ b/clang/test/Sema/conditional.c @@ -6,9 +6,9 @@ void _efree(void *ptr); void free(void *ptr); int _php_stream_free1() { - return (1 ? free(0) : _efree(0)); // expected-error {{incompatible type returning 'void', expected 'int'}} + return (1 ? free(0) : _efree(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}} } int _php_stream_free2() { - return (1 ? _efree(0) : free(0)); // expected-error {{incompatible type returning 'void', expected 'int'}} + return (1 ? _efree(0) : free(0)); // expected-error {{returning 'void' from a function with incompatible result type 'int'}} } -- cgit v1.2.3