diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-21 20:05:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-21 20:05:31 +0000 |
commit | b09ab8c293833c3dbcbf78f0db5e01fec46966bf (patch) | |
tree | 268aef552d4e96e3bebc380965a452970f45d60d /test/SemaCXX/lambda-expressions.cpp | |
parent | e38fa1866e684b99c6c6e359449af9e0b6e83164 (diff) |
Only pop the expression evaluation context corresponding to a lambda
expression after we've finished the function body of the corresponding
function call operator. Otherwise, ActOnFinishFunctionBody() will see
the (unfinished) evaluation context of the lambda expression
itself. Fixes PR12031.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151082 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/lambda-expressions.cpp')
-rw-r--r-- | test/SemaCXX/lambda-expressions.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp index b54da37014..1358d9e2a3 100644 --- a/test/SemaCXX/lambda-expressions.cpp +++ b/test/SemaCXX/lambda-expressions.cpp @@ -87,3 +87,17 @@ namespace ImplicitCapture { []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} } } + +namespace PR12031 { + struct X { + template<typename T> + X(const T&); + ~X(); + }; + + void f(int i, X x); + void g() { + const int v = 10; + f(v, [](){}); + } +} |