From ae530cfaf65e36fdcecb16d072422eb3d2a4518e Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Sun, 28 Sep 2008 14:02:55 +0000 Subject: [PATCH] Fix assigning to argument passed to block should not require __block. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56770 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaExpr.cpp | 2 +- test/Sema/block-args.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 9a0d0aca0e..c6115a8c38 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -436,7 +436,7 @@ Sema::ExprResult Sema::ActOnIdentifierExpr(Scope *S, SourceLocation Loc, // things like "integer constant expression" tests. // if (!CurBlock || DeclDefinedWithinScope(VD, CurBlock->TheScope, S) || - isa(VD)) + isa(VD) || isa(VD)) return new DeclRefExpr(VD, VD->getType(), Loc); // If we are in a block and the variable is outside the current block, diff --git a/test/Sema/block-args.c b/test/Sema/block-args.c index d85d582df8..42e2859c97 100644 --- a/test/Sema/block-args.c +++ b/test/Sema/block-args.c @@ -22,3 +22,8 @@ void test() { ^(int x, ...){return 5;}(arg, arg); // Explicit varargs, ok. } +int main(int argc) { + ^(int argCount) { + argCount = 3; + }(argc); +} -- 2.40.0