diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -186,6 +186,7 @@ // For compatibility with GCC. def : DiagGroup<"deprecated-copy-dtor", [DeprecatedCopyWithDtor]>; def DeprecatedDeclarations : DiagGroup<"deprecated-declarations">; +def DeprecatedRedundantConstexprStaticDef : DiagGroup<"deprecated-redundant-constexpr-static-def">; def UnavailableDeclarations : DiagGroup<"unavailable-declarations">; def UnguardedAvailabilityNew : DiagGroup<"unguarded-availability-new">; def UnguardedAvailability : DiagGroup<"unguarded-availability", @@ -224,7 +225,9 @@ DeprecatedThisCapture, DeprecatedType, DeprecatedVolatile, - DeprecatedWritableStr]>, + DeprecatedWritableStr, + DeprecatedRedundantConstexprStaticDef, + ]>, DiagCategory<"Deprecations">; def CXX20Designator : DiagGroup<"c++20-designator">; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -450,7 +450,7 @@ def warn_deprecated_redundant_constexpr_static_def : Warning< "out-of-line definition of constexpr static data member is redundant " "in C++17 and is deprecated">, - InGroup, DefaultIgnore; + InGroup, DefaultIgnore; def warn_decl_shadow : Warning<"declaration shadows a %select{" diff --git a/clang/test/CXX/basic/basic.def/p3.cpp b/clang/test/CXX/basic/basic.def/p3.cpp new file mode 100644 --- /dev/null +++ b/clang/test/CXX/basic/basic.def/p3.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -std=c++17 -verify %s -Werror -Wdeprecated -Wno-error=deprecated-redundant-constexpr-static-def + +namespace { + struct A { + static constexpr int n = 0; + }; + const int A::n; // expected-warning{{out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated}} +}