diff options
author | Steve Naroff <snaroff@apple.com> | 2008-09-28 14:02:55 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2008-09-28 14:02:55 +0000 |
commit | ae530cfaf65e36fdcecb16d072422eb3d2a4518e (patch) | |
tree | 228df73b9ebb6e0894a829fbef86fe7fc8df3e9c | |
parent | 891ed9aa87e14ce4c13155a77c09cde4555f7dd1 (diff) |
Fix <rdar://problem/6252108> 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
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 2 | ||||
-rw-r--r-- | test/Sema/block-args.c | 5 |
2 files changed, 6 insertions, 1 deletions
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<EnumConstantDecl>(VD)) + isa<EnumConstantDecl>(VD) || isa<ParmVarDecl>(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); +} |