Skip to content

Commit f87cc45

Browse files
committed
Put microsoft template parameter shadow warning behind separate flag (PR44794)
Differential revision: https://reviews.llvm.org/D75121 (cherry picked from commit 41a6612)
1 parent 3abd9cd commit f87cc45

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,8 @@ def MicrosoftExplicitConstructorCall : DiagGroup<
10141014
def MicrosoftEnumValue : DiagGroup<"microsoft-enum-value">;
10151015
def MicrosoftDefaultArgRedefinition :
10161016
DiagGroup<"microsoft-default-arg-redefinition">;
1017-
def MicrosoftTemplate : DiagGroup<"microsoft-template">;
1017+
def MicrosoftTemplateShadow : DiagGroup<"microsoft-template-shadow">;
1018+
def MicrosoftTemplate : DiagGroup<"microsoft-template", [MicrosoftTemplateShadow]>;
10181019
def MicrosoftInconsistentDllImport : DiagGroup<"inconsistent-dllimport">;
10191020
def MicrosoftRedeclareStatic : DiagGroup<"microsoft-redeclare-static">;
10201021
def MicrosoftEnumForwardReference :

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4210,7 +4210,7 @@ def err_ovl_no_viable_literal_operator : Error<
42104210
def err_template_param_shadow : Error<
42114211
"declaration of %0 shadows template parameter">;
42124212
def ext_template_param_shadow : ExtWarn<
4213-
err_template_param_shadow.Text>, InGroup<MicrosoftTemplate>;
4213+
err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
42144214
def note_template_param_here : Note<"template parameter is declared here">;
42154215
def warn_template_export_unsupported : Warning<
42164216
"exported templates are unsupported">;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -verify -fms-compatibility -Wno-microsoft -Wmicrosoft-template-shadow
2+
3+
template <typename T> // expected-note {{template parameter is declared here}}
4+
struct Outmost {
5+
template <typename T> // expected-warning {{declaration of 'T' shadows template parameter}}
6+
struct Inner {
7+
void f() {
8+
T *var;
9+
}
10+
};
11+
};

0 commit comments

Comments
 (0)