diff options
| author | Faisal Vali <faisalv@yahoo.com> | 2013-12-08 15:00:29 +0000 |
|---|---|---|
| committer | Faisal Vali <faisalv@yahoo.com> | 2013-12-08 15:00:29 +0000 |
| commit | 5ab61b09be18c22b10e0e45e871094d60d50c8f0 (patch) | |
| tree | ad9e913a5d7c07fd614fdac0d536892bd216d049 /clang | |
| parent | 21baded28cb773e51f7b033a20537cd06e32f380 (diff) | |
| download | bcm5719-llvm-5ab61b09be18c22b10e0e45e871094d60d50c8f0.tar.gz bcm5719-llvm-5ab61b09be18c22b10e0e45e871094d60d50c8f0.zip | |
Fix an assertion introduced by my previous refactoring.
Add back the test that was triggering the assertion (which I removed mistakenly thinking it was triggering just a warning and not an assertion). My error was brought to my attention by Rafael (Thanks!).
llvm-svn: 196721
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 10 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx1y-init-captures.cpp | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index 0719f4156f3..5ed4c6153d3 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -181,12 +181,10 @@ Optional<unsigned> clang::getStackIndexOfNearestEnclosingCaptureCapableLambda( return FailDistance; const unsigned IndexOfCaptureReadyLambda = OptionalStackIndex.getValue(); - assert( - ((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) || - (S.getCurGenericLambda() && S.getCurGenericLambda()->ImpCaptureStyle != - sema::LambdaScopeInfo::ImpCap_None)) && - "The capture ready lambda for a potential capture can only be the " - "current lambda if it is a generic lambda with an implicit capture"); + assert(((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) || + S.getCurGenericLambda()) && + "The capture ready lambda for a potential capture can only be the " + "current lambda if it is a generic lambda with an implicit capture"); const sema::LambdaScopeInfo *const CaptureReadyLambdaLSI = cast<sema::LambdaScopeInfo>(FunctionScopes[IndexOfCaptureReadyLambda]); diff --git a/clang/test/SemaCXX/cxx1y-init-captures.cpp b/clang/test/SemaCXX/cxx1y-init-captures.cpp index 2cb4d31ffc4..046773f6113 100644 --- a/clang/test/SemaCXX/cxx1y-init-captures.cpp +++ b/clang/test/SemaCXX/cxx1y-init-captures.cpp @@ -32,11 +32,18 @@ namespace variadic_expansion { void h(int i, char c) { g(i, c); } //expected-note{{in instantiation}} } +namespace simple_init_captures { + void test() { + int i; + auto L = [i](auto a) { return i + a; }; + L(3.14); + } +} namespace odr_use_within_init_capture { int test() { - + { // no captures const int x = 10; auto L = [z = x + 2](int a) { |

