diff options
Diffstat (limited to 'test/SemaCXX/warn-thread-safety-parsing.cpp')
-rw-r--r-- | test/SemaCXX/warn-thread-safety-parsing.cpp | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/test/SemaCXX/warn-thread-safety-parsing.cpp b/test/SemaCXX/warn-thread-safety-parsing.cpp index 8aa6a91..df9415c 100644 --- a/test/SemaCXX/warn-thread-safety-parsing.cpp +++ b/test/SemaCXX/warn-thread-safety-parsing.cpp @@ -1255,7 +1255,7 @@ public: void foo4(FooLate *f) EXCLUSIVE_LOCKS_REQUIRED(f->mu); static void foo5() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ - // expected-error {{'this' cannot be implicitly used in a static member function declaration}} + // expected-error {{invalid use of member 'mu' in static member function}} template <class T> void foo6() EXCLUSIVE_LOCKS_REQUIRED(T::statmu) { } @@ -1440,3 +1440,50 @@ void Foo::bar(Mutex* mu) LOCKS_EXCLUDED(mu) { } // \ } // end namespace InvalidDeclTest + +namespace StaticScopeTest { + +class FooStream; + +class Foo { + mutable Mutex mu; + int a GUARDED_BY(mu); + + static int si GUARDED_BY(mu); // \ + // expected-error {{invalid use of non-static data member 'mu'}} + + static void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ + // expected-error {{invalid use of member 'mu' in static member function}} + + friend FooStream& operator<<(FooStream& s, const Foo& f) + EXCLUSIVE_LOCKS_REQUIRED(mu); // \ + // expected-error {{invalid use of non-static data member 'mu'}} +}; + + +} // end namespace StaticScopeTest + + +namespace FunctionAttributesInsideClass_ICE_Test { + +class Foo { +public: + /* Originally found when parsing foo() as an ordinary method after the + * the following: + + template <class T> + void syntaxErrorMethod(int i) { + if (i) { + foo( + } + } + */ + + void method() { + void foo() EXCLUSIVE_LOCKS_REQUIRED(mu); // \ + // expected-error {{use of undeclared identifier 'mu'}} + } +}; + +} // end namespace FunctionAttributesInsideClass_ICE_Test + |