Files
codeql/cpp/ql/test/library-tests/lambdas/captures/captures.cpp
2019-08-23 08:44:29 +01:00

28 lines
351 B
C++

struct foo {
void a(int x) {
[x, this] {
a(x + 1);
};
}
void b(int x) {
[=] {
b(x + 1);
};
}
static void c(int x) {
[x] {
c(0); // `x` is unused, but still captured.
};
}
};
int d(int x, int y) {
auto myLambda = [&, x](int z) -> int {
return x + y + z;
};
return myLambda(1000);
}