Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/language/attributes/deprecated"

From cppreference.com
< cpp‎ | language‎ | attributes
m (T. Canens moved page cpp/attribute/deprecated to cpp/language/attributes/deprecated without leaving a redirect: Text replace - "cpp/attribute" to "cpp/language/attributes")
m (Text replace - "cpp/attribute" to "cpp/language/attributes")
Line 1: Line 1:
{{cpp/attribute/title|deprecated|notes={{mark since c++14}}}}
+
{{cpp/language/attributes/title|deprecated|notes={{mark since c++14}}}}
{{cpp/attribute/navbar}}
+
{{cpp/language/attributes/navbar}}
  
 
Indicates that the use of the name or entity declared with this attribute is allowed, but discouraged for some reason.
 
Indicates that the use of the name or entity declared with this attribute is allowed, but discouraged for some reason.

Revision as of 07:45, 24 June 2018

 
 
C++ language
General topics
Flow control
Conditional execution statements
if
Iteration statements (loops)
for
range-for (C++11)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications (until C++17*)
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
const/volatile
decltype (C++11)
auto (C++11)
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
explicit (C++11)
static

Special member functions
Templates
Miscellaneous
 
 
Attributes
(C++23)
deprecated
(C++14)
(C++20)
(C++17)
(C++11)
(C++20)
 

Indicates that the use of the name or entity declared with this attribute is allowed, but discouraged for some reason.

Syntax

class-key [[deprecatedreason(optional)]] class-name ; (1)
class-key [[deprecatedreason(optional)]] class-name final(optional) base-clause(optional) { member-specification } (2)
using identifier [[deprecatedreason(optional)]] = defining-type-id ; (3)
[[deprecatedreason(optional)]] declaration (4)
declarator-id [[deprecatedreason(optional)]] (5)
inline(optional) namespace [[deprecatedreason(optional)]] name { namespace-body } (6)
enum-key [[deprecatedreason(optional)]] enumeration-name enum-base(optional) ; (7)
enum-key [[deprecatedreason(optional)]] enumeration-name enum-base(optional) { enumerator-list } (8)
enumerator [[deprecatedreason(optional)]] (9)

reason, if present, has the form ( string-literal ).

Explanation

Indicates that the use of the name or entity declared with this attribute is allowed, but discouraged for some reason.

This attribute is allowed in declarations of classes, typedef-names, variables, non-static data members, functions, namespaces, enumerations, enumerators, and template specializations.

A name declared non-deprecated may be redeclared deprecated. A name declared deprecated cannot be un-deprecated by redeclaring it without this attribute.

Example