xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
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
6 namespace non_inline_function {
foo()7 void foo() {
8   auto L = [](int a) {
9     return [](char b) {
10      return b;
11     };
12   };
13   L(3)('a');
14 }
15 }
16 
17 namespace non_template {
18   struct L {
__anond1ca49d60402(int b) 19     int t = ([](int a) { return [](int b) { return b; };})(2)(3);
20   };
21   L l;
22 }
23 
24 namespace lambdas_in_NSDMIs_template_class {
25 template<class T>
26 struct L {
__anond1ca49d60502lambdas_in_NSDMIs_template_class::L27     T t2 = ([](int a) { return [](int b) { return b; };})(T{})(T{});
28 };
29 L<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
35 namespace inline_function {
foo()36 inline int foo() {
37   auto L = [](int a) {
38     return [](char b) {
39      return b;
40     };
41   };
42   L(3)('a');
43 }
44 int 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