Title
Static data members of classes with typedef name for linkage purposes
Status
drafting
Section
11.4.9.3 [class.static.data]
Submitter
Mike Miller

Created on 2011-03-29.00:00:00 last changed 141 months ago

Messages

Date: 2012-08-15.00:00:00

Additional note (August, 2012):

It was observed that, since no definition of a const static data member is required if it is not odr-used, there is no reason to prohibit such members in an unnamed class even without a typedef name for linkage purposes.

Date: 2011-03-29.00:00:00

According to 11.4.9.3 [class.static.data] paragraph 4,

Unnamed classes and classes contained directly or indirectly within unnamed classes shall not contain static data members.

There is no such restriction on member functions, and there is no rationale for this difference, given that both static data members and member functions can be defined outside a unnamed class with a typedef name for linkage purposes. (Issue 406 acknowledged the lack of rationale by removing the specious note in 11.4.9.3 [class.static.data] that attempted to explain the restriction but left the normative prohibition in place.)

It would be more consistent to remove the restriction for classes with a typedef name for linkage purposes.

History
Date User Action Args
2012-09-24 00:00:00adminsetmessages: + msg3897
2011-03-29 00:00:00admincreate