forked from OSchip/llvm-project
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:
parent
21baded28c
commit
5ab61b09be
|
@ -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]);
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
Loading…
Reference in New Issue