[clang] 41a6612 - Put microsoft template parameter shadow warning behind separate flag (PR44794)
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 26 07:05:18 PST 2020
Author: Hans Wennborg
Date: 2020-02-26T16:04:40+01:00
New Revision: 41a6612ea8afc5254e4de3aca55628d37f0be433
URL: https://github.com/llvm/llvm-project/commit/41a6612ea8afc5254e4de3aca55628d37f0be433
DIFF: https://github.com/llvm/llvm-project/commit/41a6612ea8afc5254e4de3aca55628d37f0be433.diff
LOG: Put microsoft template parameter shadow warning behind separate flag (PR44794)
Differential revision: https://reviews.llvm.org/D75121
Added:
clang/test/SemaCXX/microsoft-template-shadow.cpp
Modified:
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 77db3db09cdb..6c79ea591734 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1018,7 +1018,8 @@ def MicrosoftExplicitConstructorCall : DiagGroup<
def MicrosoftEnumValue : DiagGroup<"microsoft-enum-value">;
def MicrosoftDefaultArgRedefinition :
DiagGroup<"microsoft-default-arg-redefinition">;
-def MicrosoftTemplate : DiagGroup<"microsoft-template">;
+def MicrosoftTemplateShadow : DiagGroup<"microsoft-template-shadow">;
+def MicrosoftTemplate : DiagGroup<"microsoft-template", [MicrosoftTemplateShadow]>;
def MicrosoftInconsistentDllImport : DiagGroup<"inconsistent-dllimport">;
def MicrosoftRedeclareStatic : DiagGroup<"microsoft-redeclare-static">;
def MicrosoftEnumForwardReference :
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 91688cf99f9c..5cfb12967f14 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -4273,7 +4273,7 @@ def err_ovl_no_viable_literal_operator : Error<
def err_template_param_shadow : Error<
"declaration of %0 shadows template parameter">;
def ext_template_param_shadow : ExtWarn<
- err_template_param_shadow.Text>, InGroup<MicrosoftTemplate>;
+ err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
def note_template_param_here : Note<"template parameter is declared here">;
def warn_template_export_unsupported : Warning<
"exported templates are unsupported">;
diff --git a/clang/test/SemaCXX/microsoft-template-shadow.cpp b/clang/test/SemaCXX/microsoft-template-shadow.cpp
new file mode 100644
index 000000000000..ab2ffdefdd8f
--- /dev/null
+++ b/clang/test/SemaCXX/microsoft-template-shadow.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -verify -fms-compatibility -Wno-microsoft -Wmicrosoft-template-shadow
+
+template <typename T> // expected-note {{template parameter is declared here}}
+struct Outmost {
+ template <typename T> // expected-warning {{declaration of 'T' shadows template parameter}}
+ struct Inner {
+ void f() {
+ T *var;
+ }
+ };
+};
More information about the cfe-commits
mailing list