Skip to content
Commit 3ba65350 authored by Akira Hatanaka's avatar Akira Hatanaka
Browse files

[CodeGenObjCXX] Don't rematerialize default arguments of function

parameters in the body of a block.

This fixes a bug where clang would materialize the default argument
inside the body of a block instead of passing the value via the block
descriptor.

For example, in the code below, foo1 would always print 42 regardless
of the value of argument "a" passed to foo1.

void foo1(const int a = 42 ) {
  auto block = ^{
    printf("%d\n", a);
  };
  block();
}

rdar://problem/24449235

llvm-svn: 268314
parent 64f7a995
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment