File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
compiler-rt/test/asan/TestCases/Windows Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %clangxx_asan %s -o %t
2+ // RUN: %run %t | FileCheck %s
3+
4+ // This test tests that declaring a parameter in a catch-block does not produce a false positive
5+ // ASan error on Windows.
6+
7+ // This code is based on the repro in https://github.com/google/sanitizers/issues/749
8+ #include < cstdio>
9+ #include < exception>
10+
11+ void throwInFunction (){
12+ throw std::exception (" test2" );
13+ }
14+
15+ int main ()
16+ {
17+ // case 1: direct throw
18+ try {
19+ throw std::exception (" test1" );
20+ } catch (const std::exception& ex){
21+ puts (ex.what ());
22+ // CHECK: test1
23+ }
24+
25+ // case 2: throw in function
26+ try {
27+ throwInFunction ();
28+ } catch (const std::exception& ex){
29+ puts (ex.what ());
30+ // CHECK: test2
31+ }
32+
33+ printf (" Success!\n " );
34+ // CHECK: Success!
35+ return 0 ;
36+ }
You can’t perform that action at this time.
0 commit comments