Files
cppdraft_translate/cppdraft/depr/static/constexpr.md
2025-10-25 03:02:53 +03:00

19 lines
831 B
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[depr.static.constexpr]
# Annex D (normative) Compatibility features [[depr]](./#depr)
## D.7 Redeclaration of static constexpr data members [depr.static.constexpr]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/future.tex#L148)
For compatibility with prior revisions of C++, a constexpr static data member may be redundantly redeclared outside the class with no
initializer ([[basic.def]](basic.def "6.2Declarations and definitions"), [[class.static.data]](class.static.data "11.4.9.3Static data members"))[.](#1.sentence-1)
This usage is deprecated[.](#1.sentence-2)
[*Example [1](#example-1)*: struct A {static constexpr int n = 5; // definition (declaration in C++ 2014)};
constexpr int A::n; // redundant declaration (definition in C++ 2014) — *end example*]