blocks-irgen.mm revision 8443188a8f9cbd27612b7058cdcfc53356f024a3
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*)* @___ZN7PR127462f1EPi_block_invoke 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 @___ZN7PR127462f1EPi_block_invoke
17  // CHECK: call zeroext i1 @"_ZZZN7PR127462f1EPiEUb_ENK3$_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