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;
|
return FailDistance;
|
||||||
|
|
||||||
const unsigned IndexOfCaptureReadyLambda = OptionalStackIndex.getValue();
|
const unsigned IndexOfCaptureReadyLambda = OptionalStackIndex.getValue();
|
||||||
assert(
|
assert(((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) ||
|
||||||
((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) ||
|
S.getCurGenericLambda()) &&
|
||||||
(S.getCurGenericLambda() && S.getCurGenericLambda()->ImpCaptureStyle !=
|
"The capture ready lambda for a potential capture can only be the "
|
||||||
sema::LambdaScopeInfo::ImpCap_None)) &&
|
"current lambda if it is a generic lambda with an implicit capture");
|
||||||
"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 =
|
const sema::LambdaScopeInfo *const CaptureReadyLambdaLSI =
|
||||||
cast<sema::LambdaScopeInfo>(FunctionScopes[IndexOfCaptureReadyLambda]);
|
cast<sema::LambdaScopeInfo>(FunctionScopes[IndexOfCaptureReadyLambda]);
|
||||||
|
|
|
@ -32,11 +32,18 @@ namespace variadic_expansion {
|
||||||
|
|
||||||
void h(int i, char c) { g(i, c); } //expected-note{{in instantiation}}
|
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 {
|
namespace odr_use_within_init_capture {
|
||||||
|
|
||||||
int test() {
|
int test() {
|
||||||
|
|
||||||
{ // no captures
|
{ // no captures
|
||||||
const int x = 10;
|
const int x = 10;
|
||||||
auto L = [z = x + 2](int a) {
|
auto L = [z = x + 2](int a) {
|
||||||
|
|
Loading…
Reference in New Issue