diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-15 00:08:05 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-15 00:08:05 +0000 |
commit | c2223ab255b2a4e5be83c36c66565263cf3c7f9a (patch) | |
tree | b25ae74139e2c6d2ba28713a59bd9ca1c593203a /clang/test/Sema/exprs.c | |
parent | 1be3b53d3c4066f536ed07a5cb1f0a8cdac0d445 (diff) | |
download | bcm5719-llvm-c2223ab255b2a4e5be83c36c66565263cf3c7f9a.tar.gz bcm5719-llvm-c2223ab255b2a4e5be83c36c66565263cf3c7f9a.zip |
Improve "assignment to cast" diagnostic.
- Strip off extra parens when looking for casts.
- Change the location info to point at the cast (instead of the
assignment).
For example, on
int *b;
#define a ((void*) b)
void f0() {
a = 10;
}
we now emit:
/tmp/t.c:4:3: error: assignment to cast is illegal, lvalue casts are not supported
a = 10;
^ ~
/tmp/t.c:2:12: note: instantiated from:
#define a ((void*) b)
~^~~~~~~~~~
instead of:
/tmp/t.c:4:5: error: expression is not assignable
a = 10;
~ ^
llvm-svn: 69114
Diffstat (limited to 'clang/test/Sema/exprs.c')
-rw-r--r-- | clang/test/Sema/exprs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c index 617eaa086cf..d92141ce1df 100644 --- a/clang/test/Sema/exprs.c +++ b/clang/test/Sema/exprs.c @@ -34,7 +34,8 @@ void test4() { // rdar://6319320 void test5(int *X, float *P) { (float*)X = P; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}} - ((float*)X) = P; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}} +#define FOO ((float*) X) + FOO = P; // expected-error {{assignment to cast is illegal, lvalue casts are not supported}} } void test6() { |