A quick fix to PR17877 that was introduced by r194188 (generic-lambda-capturing) that broke libc++.

See http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-November/033369.html for discussion on cfe-dev.

This fix explicitly checks whether we are within the declcontext of a lambda's call operator - which is what I had intended to be true (and assumed would be true if getCurLambda returns a valid pointer) before checking whether a lambda can capture the potential-captures of the innermost lambda.

A deeper fix (that addresses why getCurLambda() returns a valid pointer when perhaps it shouldn't?) - as proposed by Richard Smith in http://llvm.org/bugs/show_bug.cgi?id=17877 - has been suggested as a FIXME.

Patch was LGTM'd by Richard (just barely :)

http://llvm-reviews.chandlerc.com/D2144

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194448 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed