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
This commit is contained in:
Faisal Vali 2013-12-08 15:00:29 +00:00
parent 21baded28c
commit 5ab61b09be
2 changed files with 12 additions and 7 deletions

View File

@ -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]);

View File

@ -32,6 +32,13 @@ 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 {