suggest ``#else`` as an alternative. ``#elifdef`` and ``#elifndef`` are only
suggested when in C2x or C++2b mode. Fixes
`Issue 51598 <https://github.com/llvm/llvm-project/issues/51598>`_.
+- The ``-Wdeprecated`` diagnostic will now warn on out-of-line ``constexpr``
+ declarations downgraded to definitions in C++1z, in addition to the
+ existing warning on out-of-line ``const`` declarations.
Non-comprehensive list of changes in this release
-------------------------------------------------
}
// C++ doesn't have tentative definitions, so go right ahead and check here.
- if (getLangOpts().CPlusPlus &&
- New->isThisDeclarationADefinition() == VarDecl::Definition) {
+ if (getLangOpts().CPlusPlus) {
if (Old->isStaticDataMember() && Old->getCanonicalDecl()->isInline() &&
Old->getCanonicalDecl()->isConstexpr()) {
// This definition won't be a definition any more once it's been merged.
Diag(New->getLocation(),
diag::warn_deprecated_redundant_constexpr_static_def);
- } else if (VarDecl *Def = Old->getDefinition()) {
- if (checkVarDeclRedefinition(Def, New))
+ } else if (New->isThisDeclarationADefinition() == VarDecl::Definition) {
+ VarDecl *Def = Old->getDefinition();
+ if (Def && checkVarDeclRedefinition(Def, New))
return;
}
}
static constexpr int n = 0;
};
const int A::n; // expected-warning {{deprecated}}
+
+ struct B {
+ static constexpr int m = 0;
+ };
+ constexpr int B::m; // expected-warning {{deprecated}}
}