diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-14 23:26:44 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-14 23:26:44 +0000 |
commit | 5717daef564a1071c34549150e7333025ea46fa2 (patch) | |
tree | b7af9087cf5525f25c6df7f640b24be3f47119ea | |
parent | 2c78b873f4f3823ae859c15674cb3d76c8554113 (diff) |
Strip paren expressions when trying to diagnose "cast as lvalue"
extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69100 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Expr.cpp | 2 | ||||
-rw-r--r-- | test/Sema/exprs.c | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 08ab5440b1..973e662b25 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -775,7 +775,7 @@ Expr::isModifiableLvalueResult Expr::isModifiableLvalue(ASTContext &Ctx) const { // lvalue, then this is probably a use of the old-school "cast as lvalue" // GCC extension. We don't support it, but we want to produce good // diagnostics when it happens so that the user knows why. - if (const CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(this)) + if (const CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(IgnoreParens())) if (CE->getSubExpr()->isLvalue(Ctx) == LV_Valid) return MLV_LValueCast; return MLV_InvalidExpression; diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c index 9db8c9248d..617eaa086c 100644 --- a/test/Sema/exprs.c +++ b/test/Sema/exprs.c @@ -34,6 +34,7 @@ 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}} } void test6() { |