Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / compiler-rt / test / hwasan / TestCases / use-after-scope-capture.cpp
blob5ada3859fb66ae93596d787854c1d0ce18f4e740
1 // This is the ASAN test of the same name ported to HWAsan.
3 // RUN: %clangxx_hwasan --std=c++11 -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
5 // REQUIRES: aarch64-target-arch || riscv64-target-arch
7 #include <functional>
9 int main() {
10 std::function<int()> f;
12 volatile int x = 0;
13 f = [&x]() __attribute__((noinline)) {
14 return x; // BOOM
15 // CHECK: ERROR: HWAddressSanitizer: tag-mismatch
16 // We cannot assert the line, after the argument promotion pass this crashes
17 // in the BOOM line below instead, when the ref gets turned into a value.
18 // CHECK: 0x{{.*}} in {{.*}}use-after-scope-capture.cpp
19 // CHECK: Cause: stack tag-mismatch
22 return f(); // BOOM