[cfe-commits] r69100 - in /cfe/trunk: lib/AST/Expr.cpp test/Sema/exprs.c
Daniel Dunbar
daniel at zuster.org
Tue Apr 14 16:26:44 PDT 2009
Author: ddunbar
Date: Tue Apr 14 18:26:44 2009
New Revision: 69100
URL: http://llvm.org/viewvc/llvm-project?rev=69100&view=rev
Log:
Strip paren expressions when trying to diagnose "cast as lvalue"
extension.
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/test/Sema/exprs.c
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=69100&r1=69099&r2=69100&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue Apr 14 18:26:44 2009
@@ -775,7 +775,7 @@
// 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;
Modified: cfe/trunk/test/Sema/exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/exprs.c?rev=69100&r1=69099&r2=69100&view=diff
==============================================================================
--- cfe/trunk/test/Sema/exprs.c (original)
+++ cfe/trunk/test/Sema/exprs.c Tue Apr 14 18:26:44 2009
@@ -34,6 +34,7 @@
// 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() {
More information about the cfe-commits
mailing list