[cfe-commits] r72409 - in /cfe/trunk: lib/AST/Expr.cpp test/SemaCXX/blocks.cpp
Anders Carlsson
andersca at mac.com
Mon May 25 19:03:20 PDT 2009
Author: andersca
Date: Mon May 25 21:03:20 2009
New Revision: 72409
URL: http://llvm.org/viewvc/llvm-project?rev=72409&view=rev
Log:
A block that returns a reference is an lvalue.
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/test/SemaCXX/blocks.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=72409&r1=72408&r2=72409&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Mon May 25 21:03:20 2009
@@ -776,6 +776,9 @@
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;
Modified: cfe/trunk/test/SemaCXX/blocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/blocks.cpp?rev=72409&r1=72408&r2=72409&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/blocks.cpp (original)
+++ cfe/trunk/test/SemaCXX/blocks.cpp Mon May 25 21:03:20 2009
@@ -5,3 +5,7 @@
void tovoid_test(int (^f)(int, int)) {
tovoid(f);
}
+
+void reference_lvalue_test(int& (^f)()) {
+ f() = 10;
+}
More information about the cfe-commits
mailing list