]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/6252108> assigning to argument passed to block should not require...
authorSteve Naroff <snaroff@apple.com>
Sun, 28 Sep 2008 14:02:55 +0000 (14:02 +0000)
committerSteve Naroff <snaroff@apple.com>
Sun, 28 Sep 2008 14:02:55 +0000 (14:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56770 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Sema/block-args.c

index 9a0d0aca0e66d6f74316b520aa3a969dfce8e092..c6115a8c385cf6dacca226c11ea9a15a4d244b8c 100644 (file)
@@ -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,
index d85d582df8003eb08866fbdce3a605dd4505cee7..42e2859c9753795c8109a8808829766f117dce1f 100644 (file)
@@ -22,3 +22,8 @@ void test() {
   ^(int x, ...){return 5;}(arg, arg);   // Explicit varargs, ok.
 }
 
+int main(int argc) {
+  ^(int argCount) {
+    argCount = 3;
+  }(argc);
+}