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