1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -fblocks -emit-llvm -o - %s -fexceptions -std=c++1y | 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 // CHECK-LABEL: define linkonce_odr void @_ZN19non_inline_function4foo2IiEEDav() 7*f4a2713aSLionel Sambuc namespace non_inline_function { foo()8*f4a2713aSLionel Sambucauto foo() { 9*f4a2713aSLionel Sambuc auto L = [](int a) { 10*f4a2713aSLionel Sambuc return [](char b) { 11*f4a2713aSLionel Sambuc return b; 12*f4a2713aSLionel Sambuc }; 13*f4a2713aSLionel Sambuc }; 14*f4a2713aSLionel Sambuc L(3)('a'); 15*f4a2713aSLionel Sambuc return L; 16*f4a2713aSLionel Sambuc } 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc template<typename T> foo2()19*f4a2713aSLionel Sambucauto foo2() { 20*f4a2713aSLionel Sambuc return [](const T&) { return 42; }; 21*f4a2713aSLionel Sambuc } 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc auto use = foo2<int>(); 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc } 26*f4a2713aSLionel Sambuc //CHECK-LABEL: define linkonce_odr void @_ZN22inline_member_function1X3fooEv(%"struct.inline_member_function::X"* %this) 27*f4a2713aSLionel Sambuc //CHECK-LABEL: define linkonce_odr void @_ZZN22inline_member_function1X3fooEvENKUliE_clEi(%class.anon 28*f4a2713aSLionel Sambuc //CHECK-LABEL: define linkonce_odr signext i8 @_ZZZN22inline_member_function1X3fooEvENKUliE_clEiENKUlcE_clEc(%class.anon 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc namespace inline_member_function { 31*f4a2713aSLionel Sambuc struct X { fooinline_member_function::X32*f4a2713aSLionel Sambucauto foo() { 33*f4a2713aSLionel Sambuc auto L = [](int a) { 34*f4a2713aSLionel Sambuc return [](char b) { 35*f4a2713aSLionel Sambuc return b; 36*f4a2713aSLionel Sambuc }; 37*f4a2713aSLionel Sambuc }; 38*f4a2713aSLionel Sambuc return L; 39*f4a2713aSLionel Sambuc } 40*f4a2713aSLionel Sambuc }; 41*f4a2713aSLionel Sambuc 42*f4a2713aSLionel Sambuc auto run1 = X{}.foo()(3)('a'); 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc template<typename S> 45*f4a2713aSLionel Sambuc struct A { default_lambdainline_member_function::A46*f4a2713aSLionel Sambuc template<typename T> static auto default_lambda() { 47*f4a2713aSLionel Sambuc return [](const T&) { return 42; }; 48*f4a2713aSLionel Sambuc } 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc template<class U = decltype(default_lambda<S>())> funcinline_member_function::A51*f4a2713aSLionel Sambuc U func(U u = default_lambda<S>()) { return u; } 52*f4a2713aSLionel Sambuc fooinline_member_function::A53*f4a2713aSLionel Sambuc template<class T> auto foo() { return [](const T&) { return 42; }; } 54*f4a2713aSLionel Sambuc }; 55*f4a2713aSLionel Sambuc //CHECK-LABEL: define linkonce_odr i32 @_ZZN22inline_member_function1AIdE14default_lambdaIdEEDavENKUlRKdE_clES5_(%class.anon 56*f4a2713aSLionel Sambuc int run2 = A<double>{}.func()(3.14); 57*f4a2713aSLionel Sambuc 58*f4a2713aSLionel Sambuc //CHECK-LABEL: define linkonce_odr i32 @_ZZN22inline_member_function1AIcE14default_lambdaIcEEDavENKUlRKcE_clES5_(%class.anon 59*f4a2713aSLionel Sambuc int run3 = A<char>{}.func()('a'); 60*f4a2713aSLionel Sambuc } // end inline_member_function 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc 63*f4a2713aSLionel Sambuc // CHECK-LABEL: define linkonce_odr void @_ZN15inline_function3fooEv() 64*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr void @_ZZN15inline_function3fooEvENKUliE_clEi(%class.anon 65*f4a2713aSLionel Sambuc // CHECK: define linkonce_odr signext i8 @_ZZZN15inline_function3fooEvENKUliE_clEiENKUlcE_clEc(%class.anon 66*f4a2713aSLionel Sambuc namespace inline_function { foo()67*f4a2713aSLionel Sambucinline auto foo() { 68*f4a2713aSLionel Sambuc auto L = [](int a) { 69*f4a2713aSLionel Sambuc return [](char b) { 70*f4a2713aSLionel Sambuc return b; 71*f4a2713aSLionel Sambuc }; 72*f4a2713aSLionel Sambuc }; 73*f4a2713aSLionel Sambuc return L; 74*f4a2713aSLionel Sambuc } 75*f4a2713aSLionel Sambuc auto use = foo()(3)('a'); 76*f4a2713aSLionel Sambuc } 77*f4a2713aSLionel Sambuc 78