diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-30 23:33:33 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-04-30 23:33:33 +0000 |
commit | aa5498649c7ad1b61e5da2497e8c60c924ac5e55 (patch) | |
tree | 27b5c46390520d6b72dede160cb8de0832a35aa1 | |
parent | e720ce7a3b1c1bfa5f7482183caa6e31fca9a3fb (diff) |
Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'
being used in an exception specification in a way which isn't otherwise
ill-formed in C++98: this warning also incorrectly triggered on uses of 'this'
inside thread-safety attributes, and the mechanism required to tell these cases
apart is more complex than can be justified by the (minimal) value of this part
of -Wc++98-compat.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155857 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 3 | ||||
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 4 | ||||
-rw-r--r-- | test/SemaCXX/cxx98-compat.cpp | 10 | ||||
-rw-r--r-- | test/SemaCXX/warn-thread-safety-analysis.cpp | 1 |
4 files changed, 1 insertions, 17 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 53fb9ec952..141bd4cc44 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -3849,9 +3849,6 @@ def err_this_static_member_func : Error< "declaration">; def err_invalid_member_use_in_static_method : Error< "invalid use of member %0 in static member function">; -def warn_cxx98_compat_this_outside_method : Warning< - "use of 'this' outside a non-static member function is incompatible " - "with C++98">, InGroup<CXX98Compat>, DefaultIgnore; def err_invalid_qualified_function_type : Error< "%select{static |non-}0member function %select{of type %2 |}1" "cannot have '%3' qualifier">; diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 7d345073d7..af0f971c1c 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -693,10 +693,6 @@ Sema::CXXThisScopeRAII::~CXXThisScopeRAII() { } void Sema::CheckCXXThisCapture(SourceLocation Loc, bool Explicit) { - if (getLangOpts().CPlusPlus0x && - !dyn_cast_or_null<CXXMethodDecl>(getFunctionLevelDeclContext())) - Diag(Loc, diag::warn_cxx98_compat_this_outside_method); - // We don't need to capture this in an unevaluated context. if (ExprEvalContexts.back().Context == Unevaluated && !Explicit) return; diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp index cd3ffed546..b9a8a1c65e 100644 --- a/test/SemaCXX/cxx98-compat.cpp +++ b/test/SemaCXX/cxx98-compat.cpp @@ -328,16 +328,6 @@ namespace NonTypeTemplateArgs { S<void(&)(), f> s2; // expected-warning {{non-type template argument referring to function 'f' with internal linkage is incompatible with C++98}} } -namespace ThisInExceptionSpec { - template<int> struct T {}; - struct S { - int n; - void f() throw (T<sizeof(n)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}} - void g() throw (T<sizeof(S::n)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}} - void h() throw (T<sizeof(this)>); // expected-warning {{use of 'this' outside a non-static member function is incompatible with C++98}} - }; -} - namespace NullPointerTemplateArg { struct A {}; template<int*> struct X {}; diff --git a/test/SemaCXX/warn-thread-safety-analysis.cpp b/test/SemaCXX/warn-thread-safety-analysis.cpp index 566e5c1b84..47d844d003 100644 --- a/test/SemaCXX/warn-thread-safety-analysis.cpp +++ b/test/SemaCXX/warn-thread-safety-analysis.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety %s +// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -std=c++11 -Wc++98-compat %s #define LOCKABLE __attribute__ ((lockable)) #define SCOPED_LOCKABLE __attribute__ ((scoped_lockable)) |