summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/AST/Expr.cpp2
-rw-r--r--clang/test/Sema/exprs.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 08ab5440b16..973e662b25f 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/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/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c
index 9db8c9248de..617eaa086cf 100644
--- a/clang/test/Sema/exprs.c
+++ b/clang/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() {
OpenPOWER on IntegriCloud