diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-38.C')
-rw-r--r-- | gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-38.C | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-38.C b/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-38.C new file mode 100644 index 00000000000..9140a4911a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/thread-ann/thread_annot_lock-38.C @@ -0,0 +1,23 @@ +// Test the case where a template member function is annotated with lock +// attributes in a non-template class. +// This is a "good" test that should not incur any compiler warnings. +// { dg-do compile } +// { dg-options "-Wthread-safety -Wthread-unsupported-lock-name -O" } + +#include "thread_annot_common.h" + +class Foo { + public: + void func1(int y) LOCKS_EXCLUDED(mu_); + template <typename T> void func2(T x) LOCKS_EXCLUDED(mu_); + private: + Mutex mu_; +}; + +Foo *foo; + +int main() +{ + foo->func1(5); + foo->func2(5); +} |