Created on 2009-04-29.00:00:00 last changed 179 months ago
[Voted into WP at October, 2009 meeting.]
Proposed resolution (July, 2009):
Change 13.9.4 [temp.expl.spec] paragraphs 15-16 as follows:
An explicit specialization of a static data member of a template is a definition if the declaration includes an initializer; otherwise, it is a declaration. [Note:
there is no syntax for theThe definition of a static data member of a template that requires default initialization.must use a braced-init-list:template<> X Q<int>::x; // declaration template<> X Q<int>::x (); // error: declares a function template<> X Q<int>::x {}; // definition
This is a declaration regardless of whether X can be default initialized (9.4 [dcl.init]).—end note]
13.9.4 [temp.expl.spec] paragraphs 15-16 contain the following note:
[Note: there is no syntax for the definition of a static data member of a template that requires default initialization.template<> X Q<int>::x;This is a declaration regardless of whether X can be default initialized (9.4 [dcl.init]). —end note]
While this note is still accurate, the C++0x list initialization syntax provides a way around the restriction, which could be useful if the class is not copyable or movable but has a default constructor. Perhaps the note should be updated to mention that possibility?
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-03-29 00:00:00 | admin | set | status: dr -> cd2 |
2009-11-08 00:00:00 | admin | set | messages: + msg2476 |
2009-11-08 00:00:00 | admin | set | status: ready -> dr |
2009-08-03 00:00:00 | admin | set | messages: + msg2178 |
2009-08-03 00:00:00 | admin | set | status: open -> ready |
2009-04-29 00:00:00 | admin | create |