diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-04-04 17:40:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-04-04 17:40:10 +0000 |
commit | f54486acc1cadf2791c3916ece66fded1e57ba0b (patch) | |
tree | 50d408c6476749d089f753d8694cdf09a0c6eefe /test/CodeGenCXX/mangle-lambdas.cpp | |
parent | 8e86b2d03e6e58ef9a58d1d3ad70726ae7a3b4fd (diff) |
Move the computation of the lambda mangling information (mangling
number + context) to the point where we initially start defining the
lambda, so that the linkage won't change when that information is made
available. Fixes the assertion in <rdar://problem/11182962>.
Plus, actually mangle the context of lambdas properly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154029 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle-lambdas.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-lambdas.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-lambdas.cpp b/test/CodeGenCXX/mangle-lambdas.cpp index e8bd6ec47b..cc53b01057 100644 --- a/test/CodeGenCXX/mangle-lambdas.cpp +++ b/test/CodeGenCXX/mangle-lambdas.cpp @@ -150,6 +150,8 @@ void use_func_template() { func_template<int>(); } +// CHECK: define linkonce_odr void @_Z1fIZZNK23TestNestedInstantiationclEvENKUlvE_clEvEUlvE_EvT_ + struct Members { int x = [] { return 1; }() + [] { return 2; }(); int y = [] { return 3; }(); @@ -165,6 +167,20 @@ void test_Members() { // CHECK: ret void } +template<typename P> void f(P) { } + +struct TestNestedInstantiation { + void operator()() const { + []() -> void { + return f([]{}); + }(); + } +}; + +void test_NestedInstantiation() { + TestNestedInstantiation()(); +} + // Check the linkage of the lambdas used in test_Members. // CHECK: define linkonce_odr i32 @_ZNK7Members1xMUlvE_clEv // CHECK: ret i32 1 |