diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/cxx0x-noexcept-expression.cpp | 19 | ||||
-rw-r--r-- | test/SemaCXX/thread-safety-reference-handling.cpp | 17 | ||||
-rw-r--r-- | test/SemaCXX/warn-thread-safety-negative.cpp | 17 |
3 files changed, 53 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-noexcept-expression.cpp b/test/SemaCXX/cxx0x-noexcept-expression.cpp new file mode 100644 index 0000000000000..f1fe01a845fdb --- /dev/null +++ b/test/SemaCXX/cxx0x-noexcept-expression.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +void f(); // expected-note {{possible target for call}} +void f(int); // expected-note {{possible target for call}} + +void g() { + bool b = noexcept(f); // expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}} + bool b2 = noexcept(f(0)); +} + +struct S { + void g(); // expected-note {{possible target for call}} + void g(int); // expected-note {{possible target for call}} + + void h() { + bool b = noexcept(this->g); // expected-error {{reference to non-static member function must be called; did you mean to call it with no arguments?}} + bool b2 = noexcept(this->g(0)); + } +}; diff --git a/test/SemaCXX/thread-safety-reference-handling.cpp b/test/SemaCXX/thread-safety-reference-handling.cpp new file mode 100644 index 0000000000000..2f7eb48d34366 --- /dev/null +++ b/test/SemaCXX/thread-safety-reference-handling.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety-analysis -std=c++11 %s +// expected-no-diagnostics + +class Base { +public: + Base() {} + virtual ~Base(); +}; + +class S : public Base { +public: + ~S() override = default; +}; + +void Test() { + const S &s = S(); +} diff --git a/test/SemaCXX/warn-thread-safety-negative.cpp b/test/SemaCXX/warn-thread-safety-negative.cpp index f88233a60b27d..f831010293b61 100644 --- a/test/SemaCXX/warn-thread-safety-negative.cpp +++ b/test/SemaCXX/warn-thread-safety-negative.cpp @@ -102,3 +102,20 @@ public: }; } // end namespace SimpleTest + +namespace DoubleAttribute { + +struct Foo { + Mutex &mutex(); +}; + +template <typename A> +class TemplateClass { + template <typename B> + static void Function(Foo *F) + EXCLUSIVE_LOCKS_REQUIRED(F->mutex()) UNLOCK_FUNCTION(F->mutex()) {} +}; + +void test() { TemplateClass<int> TC; } + +} // end namespace DoubleAttribute |