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())
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) {
}
foo:
- takeclosure(^{ x = 4; }); // expected-error {{read-only variable is not assignable}}
+ takeclosure(^{ x = 4; }); // expected-error {{variable is not assignable (missing __block type specifier)}}
__block y = 7; // expected-warning {{type specifier missing, defaults to 'int'}}
takeclosure(^{ y = 8; });
}