blocks-irgen.mm revision d57f52ca4d0e9d5d42dd6947d1e66d693625cf2c
1// RUN: %clang_cc1 -std=c++11 -fblocks -emit-llvm -o - -triple x86_64-apple-darwin11.3 %s | FileCheck %s
2
3namespace PR12746 {
4  // CHECK: define zeroext i1 @_ZN7PR127462f1EPi
5  bool f1(int *x) {
6    // CHECK: store i8* bitcast (i1 (i8*)* @__f1_block_invoke_0 to i8*)
7    bool (^outer)() = ^ {
8      auto inner = [&]() -> bool {
9	return x == 0;
10      };
11      return inner();
12    };
13    return outer();
14  }
15
16  // CHECK: define internal zeroext i1 @__f1_block_invoke_0
17  // CHECK: call zeroext i1 @"_ZNK7PR127462f119__f1_block_invoke_03$_0clEv"
18
19  bool f2(int *x) {
20    auto outer = [&]() -> bool {
21      bool (^inner)() = ^ {
22	return x == 0;
23      };
24      return inner();
25    };
26    return outer();
27  }
28}
29
30