blob: 2a8eb219d3e9d6015dada9ffa29c48ef3d7a6c59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
// RUN: %clangxx_asan -std=c++11 -O1 -mllvm -asan-use-after-scope=1 %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
// XFAIL: win32
#include <functional>
int main() {
std::function<int()> f;
{
int x = 0;
f = [&x]() {
return x; // BOOM
// CHECK: ERROR: AddressSanitizer: stack-use-after-scope
// CHECK: #0 0x{{.*}} in {{.*}}::operator()(){{.*}}.cc:[[@LINE-2]]
};
}
return f(); // BOOM
}
|