1 | // RUN: %clangxx_tsan %s -o %t -framework Foundation |
2 | // RUN: %run %t 2>&1 | FileCheck %s |
3 | |
4 | #import <Foundation/Foundation.h> |
5 | |
6 | #import <memory> |
7 | |
8 | struct InnerStruct { |
9 | ~InnerStruct() { |
10 | fprintf(stderr, "~InnerStruct\n" ); |
11 | } |
12 | }; |
13 | |
14 | struct MyStruct { |
15 | std::shared_ptr<InnerStruct> inner_object; |
16 | ~MyStruct() { |
17 | fprintf(stderr, "~MyStruct\n" ); |
18 | } |
19 | }; |
20 | |
21 | int main(int argc, const char *argv[]) { |
22 | fprintf(stderr, "Hello world.\n" ); |
23 | |
24 | { |
25 | std::shared_ptr<MyStruct> shared(new MyStruct()); |
26 | shared->inner_object = std::shared_ptr<InnerStruct>(new InnerStruct()); |
27 | } |
28 | |
29 | fprintf(stderr, "Done.\n" ); |
30 | } |
31 | |
32 | // CHECK: Hello world. |
33 | // CHECK: ~MyStruct |
34 | // CHECK: ~InnerStruct |
35 | // CHECK: Done. |
36 | // CHECK-NOT: WARNING: ThreadSanitizer |
37 | |