Skip to content

Commit 41a6612

Browse files
committed
Put microsoft template parameter shadow warning behind separate flag (PR44794)
Differential revision: https://reviews.llvm.org/D75121
1 parent 0aec4b4 commit 41a6612

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
@@ -1018,7 +1018,8 @@ def MicrosoftExplicitConstructorCall : DiagGroup<
10181018
def MicrosoftEnumValue : DiagGroup<"microsoft-enum-value">;
10191019
def MicrosoftDefaultArgRedefinition :
10201020
DiagGroup<"microsoft-default-arg-redefinition">;
1021-
def MicrosoftTemplate : DiagGroup<"microsoft-template">;
1021+
def MicrosoftTemplateShadow : DiagGroup<"microsoft-template-shadow">;
1022+
def MicrosoftTemplate : DiagGroup<"microsoft-template", [MicrosoftTemplateShadow]>;
10221023
def MicrosoftInconsistentDllImport : DiagGroup<"inconsistent-dllimport">;
10231024
def MicrosoftRedeclareStatic : DiagGroup<"microsoft-redeclare-static">;
10241025
def MicrosoftEnumForwardReference :

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4273,7 +4273,7 @@ def err_ovl_no_viable_literal_operator : Error<
42734273
def err_template_param_shadow : Error<
42744274
"declaration of %0 shadows template parameter">;
42754275
def ext_template_param_shadow : ExtWarn<
4276-
err_template_param_shadow.Text>, InGroup<MicrosoftTemplate>;
4276+
err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
42774277
def note_template_param_here : Note<"template parameter is declared here">;
42784278
def warn_template_export_unsupported : Warning<
42794279
"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)