A block that returns a reference is an lvalue.

llvm-svn: 72409
This commit is contained in:
Anders Carlsson 2009-05-26 02:03:20 +00:00
parent 895771aa4b
commit 3b70b300b0
2 changed files with 7 additions and 0 deletions

View File

@ -776,6 +776,9 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
QualType CalleeType = cast<CallExpr>(this)->getCallee()->getType();
if (const PointerType *FnTypePtr = CalleeType->getAsPointerType())
CalleeType = FnTypePtr->getPointeeType();
else if (const BlockPointerType *BPT = CalleeType->getAsBlockPointerType())
CalleeType = BPT->getPointeeType();
if (const FunctionType *FnType = CalleeType->getAsFunctionType())
if (FnType->getResultType()->isLValueReferenceType())
return LV_Valid;

View File

@ -5,3 +5,7 @@ void tovoid(void*);
void tovoid_test(int (^f)(int, int)) {
tovoid(f);
}
void reference_lvalue_test(int& (^f)()) {
f() = 10;
}