summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index f2553c3390d..789fbc5ce1d 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -781,7 +781,17 @@ Expr::isModifiableLvalueResult Expr::isModifiableLvalue(ASTContext &Ctx) const {
return MLV_InvalidExpression;
case LV_MemberFunction: return MLV_MemberFunction;
}
-
+
+ // The following is illegal:
+ // void takeclosure(void (^C)(void));
+ // void func() { int x = 1; takeclosure(^{ x = 7; }); }
+ //
+ if (getStmtClass() == BlockDeclRefExprClass) {
+ const BlockDeclRefExpr *BDR = cast<BlockDeclRefExpr>(this);
+ if (!BDR->isByRef() && isa<VarDecl>(BDR->getDecl()))
+ return MLV_NotBlockQualified;
+ }
+
QualType CT = Ctx.getCanonicalType(getType());
if (CT.isConstQualified())
@@ -795,15 +805,6 @@ Expr::isModifiableLvalueResult Expr::isModifiableLvalue(ASTContext &Ctx) const {
if (r->hasConstFields())
return MLV_ConstQualified;
}
- // The following is illegal:
- // void takeclosure(void (^C)(void));
- // void func() { int x = 1; takeclosure(^{ x = 7 }); }
- //
- if (getStmtClass() == BlockDeclRefExprClass) {
- const BlockDeclRefExpr *BDR = cast<BlockDeclRefExpr>(this);
- if (!BDR->isByRef() && isa<VarDecl>(BDR->getDecl()))
- return MLV_NotBlockQualified;
- }
// Assigning to an 'implicit' property?
else if (getStmtClass() == ObjCKVCRefExprClass) {
OpenPOWER on IntegriCloud