Title
In-class initialization of non-constant static data members
Status
nad
Section
11.4.9.3 [class.static.data]
Submitter
Daniel Krügler

Created on 2009-05-21.00:00:00 last changed 186 months ago

Messages

Date: 2009-07-15.00:00:00

Rationale (July, 2009):

The consensus of the CWG was that there is insufficient motivation for such a change. A non-const static data member must still be defined outside the class if it is used, and the value of such a member cannot be used in a constant expression, unlike a constant static data member, so there is no real advantage to putting the initializer inside the class definition instead of in the definition of the static data member. The apparent parallel with non-static data member initialization is also not compelling; for example, the initializer for a non-static data member can contain forward references to members declared later in the class, while the same is not true of static data member initializers.

Date: 2022-11-20.07:54:16

The current wording of 11.4.9.3 [class.static.data] only allows a static data member to be initialized within the class definition if it is const. This restriction should be removed.

History
Date User Action Args
2009-08-03 00:00:00adminsetmessages: + msg2277
2009-08-03 00:00:00adminsetstatus: open -> nad
2009-05-21 00:00:00admincreate