forked from OSchip/llvm-project
A block that returns a reference is an lvalue.
llvm-svn: 72409
This commit is contained in:
parent
895771aa4b
commit
3b70b300b0
|
@ -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;
|
||||
|
|
|
@ -5,3 +5,7 @@ void tovoid(void*);
|
|||
void tovoid_test(int (^f)(int, int)) {
|
||||
tovoid(f);
|
||||
}
|
||||
|
||||
void reference_lvalue_test(int& (^f)()) {
|
||||
f() = 10;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue