Created on 2012-05-06.00:00:00 last changed 130 months ago
[Moved to DR at the April, 2013 meeting.]
Proposed resolution (October, 2012):
Change 9.4 [dcl.init] paragraph 7 as follows:
To value-initialize an object of type T means:
...
if T is a (possibly cv-qualified)
non-unionclass type without a user-provided or deleted default constructor, then the object is zero-initialized and, if T has a non-trivial default constructor, default-initialized;...
According to 9.4 [dcl.init] paragraph 7,
To value-initialize an object of type T means:
if T is a (possibly cv-qualified) class type ( Clause 11 [class]) with either no default constructor (11.4.5 [class.ctor]) or a default constructor that is user-provided or deleted, then the object is default-initialized;
if T is a (possibly cv-qualified) non-union class type without a user-provided or deleted default constructor, then the object is zero-initialized and, if T has a non-trivial default constructor, default-initialized;
if T is an array type, then each element is value-initialized;
otherwise, the object is zero-initialized.
In an example like
union U { int a = 5; }; int main() { return U().a; }
this means that the value returned is 0, because none of the first three bullets apply. Should the “non-union” restriction be dropped from the second bullet?
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2013-10-14 00:00:00 | admin | set | status: dr -> drwp |
2013-05-03 00:00:00 | admin | set | messages: + msg4407 |
2013-05-03 00:00:00 | admin | set | status: ready -> dr |
2012-11-03 00:00:00 | admin | set | messages: + msg4063 |
2012-11-03 00:00:00 | admin | set | status: open -> ready |
2012-05-06 00:00:00 | admin | create |