1 | // RUN: %clang_cc1 -fsyntax-only -Wthread-safety -verify %s |
2 | |
3 | class __attribute__((shared_capability("mutex"))) Mutex { |
4 | public: |
5 | void func1() __attribute__((assert_capability(this))); |
6 | void func2() __attribute__((assert_capability(!this))); |
7 | |
8 | const Mutex& operator!() const { return *this; } |
9 | }; |
10 | |
11 | class NotACapability { |
12 | public: |
13 | void func1() __attribute__((assert_capability(this))); // expected-warning {{'assert_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'NotACapability *'}} |
14 | void func2() __attribute__((assert_capability(!this))); // expected-warning {{'assert_capability' attribute requires arguments whose type is annotated with 'capability' attribute; type here is 'bool'}} |
15 | |
16 | const NotACapability& operator!() const { return *this; } |
17 | }; |
18 | |