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"(%class.anon
5// CHECK-LABEL: define internal signext i8 @"_ZZZN19non_inline_function3fooEvENK3$_0clEiENKUlcE_clEc"(%class.anon
6namespace non_inline_function {
7void foo() {
8  auto L = [](int a) {
9    return [](char b) {
10     return b;
11    };
12  };
13  L(3)('a');
14}
15}
16
17namespace non_template {
18  struct L {
19    int t = ([](int a) { return [](int b) { return b; };})(2)(3);
20  };
21  L l;
22}
23
24namespace lambdas_in_NSDMIs_template_class {
25template<class T>
26struct L {
27    T t2 = ([](int a) { return [](int b) { return b; };})(T{})(T{});
28};
29L<int> l;
30}
31
32// CHECK-LABEL: define linkonce_odr i32 @_ZN15inline_function3fooEv
33// CHECK: define linkonce_odr void @_ZZN15inline_function3fooEvENKUliE_clEi
34// CHECK: define linkonce_odr signext i8 @_ZZZN15inline_function3fooEvENKUliE_clEiENKUlcE_clEc
35namespace inline_function {
36inline int foo() {
37  auto L = [](int a) {
38    return [](char b) {
39     return b;
40    };
41  };
42  L(3)('a');
43}
44int use = foo();
45}
46// CHECK: define linkonce_odr void @_ZNK32lambdas_in_NSDMIs_template_class1LIiEUliE_clEi(%class.anon
47// CHECK: define linkonce_odr i32 @_ZZNK32lambdas_in_NSDMIs_template_class1LIiEUliE_clEiENKUliE_clEi(%class.anon
48
49// CHECK: define linkonce_odr void @_ZNK12non_template1L1tMUliE_clEi(%class.anon
50// CHECK: define linkonce_odr i32 @_ZZNK12non_template1L1tMUliE_clEiENKUliE_clEi(%class.anon
51