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
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 9a0d0ac..c6115a8 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -436,7 +436,7 @@
   // 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 d85d582..42e2859 100644
--- a/test/Sema/block-args.c
+++ b/test/Sema/block-args.c
@@ -22,3 +22,8 @@
   ^(int x, ...){return 5;}(arg, arg);   // Explicit varargs, ok.
 }
 
+int main(int argc) {
+  ^(int argCount) {
+    argCount = 3;
+  }(argc);
+}