blob: 1755e625dd958054ced6ebb405029bc5e06bf7a4 [file] [log] [blame]
// Test the support for use of lock expression in the annotations
// This is a good test case. (i.e. There should be no warning emitted by the
// compiler.)
// { dg-do compile }
// { dg-options "-Wthread-safety -O" }
#include "thread_annot_common.h"
class Foo {
public:
Mutex foo_mu_;
};
class Bar {
private:
Foo *foo;
Mutex bar_mu_ ACQUIRED_AFTER(foo->foo_mu_);
public:
void Test1() {
foo->foo_mu_.Lock();
bar_mu_.Lock();
bar_mu_.Unlock();
foo->foo_mu_.Unlock();
}
};
main() {
Bar bar;
bar.Test1();
}