1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fblocks -emit-llvm -o - %s -fexceptions -std=c++11 | FileCheck %s
2 
3 // CHECK-LABEL: define void @_ZN19non_inline_function3fooEv()
4 // CHECK-LABEL: define internal void @"_ZZN19non_inline_function3fooEvENK3$_0clEi"
5 // CHECK-LABEL: define internal signext i8 @"_ZZZN19non_inline_function3fooEvENK3$_0clEiENKUlcE_clEc"
6 namespace non_inline_function {
7 void foo() {
8   auto L = [](int a) {
9     return [](char b) {
10      return b;
11     };
12   };
13   L(3)('a');
14 }
15 }
16 // CHECK-LABEL: define linkonce_odr i32 @_ZN15inline_function3fooEv
17 // CHECK-LABEL: define linkonce_odr void @_ZZN15inline_function3fooEvENKUliE_clEi
18 // CHECK-LABEL: define linkonce_odr signext i8 @_ZZZN15inline_function3fooEvENKUliE_clEiENKUlcE_clEc
19 namespace inline_function {
20 inline int foo() {
21   auto L = [](int a) {
22     return [](char b) {
23      return b;
24     };
25   };
26   L(3)('a');
27 }
28 int use = foo();
29 }
30 
31 // CHECK-LABEL: define linkonce_odr void @_ZN12non_template1LC1Ev
32 // CHECK-LABEL: define linkonce_odr void @_ZNK12non_template1L1tMUliE_clEi(%class.anon
33 // CHECK-LABEL: define linkonce_odr i32 @_ZZNK12non_template1L1tMUliE_clEiENKUliE_clEi(%class.anon
34 namespace non_template {
35   struct L {
36     int t = ([](int a) { return [](int b) { return b; };})(2)(3);
37   };
38   L l;
39 }
40 
41 // CHECK-LABEL: define linkonce_odr void @_ZN32lambdas_in_NSDMIs_template_class1LIiEC2Ev
42 // CHECK-LABEL: define linkonce_odr void @_ZNK32lambdas_in_NSDMIs_template_class1LIiEUliE_clEi(%class.anon
43 // CHECK-LABEL: linkonce_odr i32 @_ZZNK32lambdas_in_NSDMIs_template_class1LIiEUliE_clEiENKUliE_clEi(%class.anon
44 namespace lambdas_in_NSDMIs_template_class {
45 template<class T>
46 struct L {
47     T t2 = ([](int a) { return [](int b) { return b; };})(T{})(T{});
48 };
49 L<int> l;
50 }
51 
52 
53 
54