blob: 5bae94edaa41fdfb0c7f1222e0fd43dd5544a377 [file] [log] [blame]
Yi Kong2d58d192017-12-14 22:24:45 +00001// RUN: %clang_cc1 -fsyntax-only -Wthread-safety -verify %s
2
3class __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
11class 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};