From e5d643a3e7fb52ce6a87c84dac0de41bda6a63e7 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Fri, 29 Apr 2016 00:37:43 +0000 Subject: Avoid -Wshadow warnings about constructor parameters named after fields Usually these parameters are used solely to initialize the field in the initializer list, and there is no real shadowing confusion. There is a new warning under -Wshadow called -Wshadow-field-in-constructor-modified. It attempts to find modifications of such constructor parameters that probably intended to modify the field. It has some false negatives, though, so there is another warning group, -Wshadow-field-in-constructor, which always warns on this special case. For users who just want the old behavior and don't care about these fine grained groups, we have a new warning group called -Wshadow-all that activates everything. Fixes PR16088. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D18271 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@267957 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Diagnostic.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/clang/Basic/Diagnostic.h') diff --git a/include/clang/Basic/Diagnostic.h b/include/clang/Basic/Diagnostic.h index dd4443e5dd..085faeae48 100644 --- a/include/clang/Basic/Diagnostic.h +++ b/include/clang/Basic/Diagnostic.h @@ -1072,10 +1072,10 @@ inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, // so that we only match those arguments that are (statically) DeclContexts; // other arguments that derive from DeclContext (e.g., RecordDecls) will not // match. -template -inline -typename std::enable_if::value, - const DiagnosticBuilder &>::type +template +inline typename std::enable_if< + std::is_same::type, DeclContext>::value, + const DiagnosticBuilder &>::type operator<<(const DiagnosticBuilder &DB, T *DC) { DB.AddTaggedVal(reinterpret_cast(DC), DiagnosticsEngine::ak_declcontext); -- cgit v1.2.1