Put microsoft template parameter shadow warning behind separate flag (PR44794)

Differential revision: https://reviews.llvm.org/D75121
This commit is contained in:
Hans Wennborg 2020-02-25 16:58:36 +01:00
parent 0aec4b418e
commit 41a6612ea8
3 changed files with 14 additions and 2 deletions

View File

@ -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 :

View File

@ -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">;

View File

@ -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;
}
};
};