forked from OSchip/llvm-project
Additional test for use-after-scope
Summary: Test that asan detects access to the dead variable captured by lambda. Reviewers: aizatsky, kcc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D19238 llvm-svn: 266676
This commit is contained in:
parent
e6643daa18
commit
d8ce87f850
|
@ -0,0 +1,14 @@
|
|||
// RUN: %clangxx_asan -O0 -fsanitize=use-after-scope %s -o %t && %run %t
|
||||
// XFAIL: *
|
||||
|
||||
int main() {
|
||||
std::function<int()> f;
|
||||
{
|
||||
int x = 0;
|
||||
f = [&x]() {
|
||||
return x;
|
||||
}
|
||||
}
|
||||
return f(); // BOOM
|
||||
// CHECK: ERROR: AddressSanitizer: stack-use-after-scope
|
||||
}
|
Loading…
Reference in New Issue