diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-04-16 16:02:28 +0000 | 
| commit | 7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch) | |
| tree | c72b9241553fc9966179aba84f90f17bfa9235c3 /test/SemaCXX/template-multiple-attr-propagation.cpp | |
| parent | b52119637f743680a99710ce5fdb6646da2772af (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/template-multiple-attr-propagation.cpp')
| -rw-r--r-- | test/SemaCXX/template-multiple-attr-propagation.cpp | 29 | 
1 files changed, 29 insertions, 0 deletions
diff --git a/test/SemaCXX/template-multiple-attr-propagation.cpp b/test/SemaCXX/template-multiple-attr-propagation.cpp new file mode 100644 index 000000000000..8e7f4570bad4 --- /dev/null +++ b/test/SemaCXX/template-multiple-attr-propagation.cpp @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 %s -Wthread-safety-analysis -verify -fexceptions +// expected-no-diagnostics + +class Mutex { +public: +  void Lock() __attribute__((exclusive_lock_function())); +  void Unlock() __attribute__((unlock_function())); +}; + +class A { +public: +  Mutex mu1, mu2; + +  void foo() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {} + +  template <class T> +  void bar() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) { +    foo(); +  } +}; + +void f() { +  A a; +  a.mu1.Lock(); +  a.mu2.Lock(); +  a.bar<int>(); +  a.mu2.Unlock(); +  a.mu1.Unlock(); +}  | 
