blob: 24ce2cd6c198dec9cb5be8a57d10b2507de6f148 [file] [log] [blame]
Douglas Gregora8182f92012-05-16 17:01:33 +00001// 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) {
Fariborz Jahanian63628032012-06-26 16:06:38 +00006 // CHECK: store i8* bitcast (i1 (i8*)* @___ZN7PR127462f1EPi_block_invoke to i8*)
Douglas Gregora8182f92012-05-16 17:01:33 +00007 bool (^outer)() = ^ {
8 auto inner = [&]() -> bool {
9 return x == 0;
10 };
11 return inner();
12 };
13 return outer();
14 }
15
Fariborz Jahanian63628032012-06-26 16:06:38 +000016 // CHECK: define internal zeroext i1 @___ZN7PR127462f1EPi_block_invoke
Eli Friedman95f50122013-07-02 17:52:28 +000017 // CHECK: call zeroext i1 @"_ZZZN7PR127462f1EPiEUb_ENK3$_0clEv"
Douglas Gregora8182f92012-05-16 17:01:33 +000018
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