Created on 2016-06-10.00:00:00 last changed 82 months ago
Proposed resolution (February, 2017):
Change 9.4.2 [dcl.init.aggr] paragraph 8 as follows:
If there are fewer initializer-clauses in the list than there are elements in
thea non-union aggregate, then each element not explicitly initializedshall be initialized from its default member initializer (11.4 [class.mem]) or, if there is no default member initializer, from an empty initializer list (9.4.5 [dcl.init.list]).is initialized as follows:
If the element has a default member initializer (11.4 [class.mem]), the element is initialized from that initializer.
Otherwise, if the element is not a reference, the element is copy-initialized from an empty initializer list (9.4.5 [dcl.init.list]).
Otherwise, the program is ill-formed.
If the aggregate is a union and the initializer list is empty, then
if any variant member has a default member initializer, that member is initialized from its default member initializer;
otherwise, the first member of the union (if any) is copy-initialized from an empty initializer list.
[Example:...
Delete 9.4.2 [dcl.init.aggr] paragraph 11:
If an incomplete or empty initializer-list leaves a member of reference type uninitialized, the program is ill-formed.
[Adopted at the February/March, 2017 meeting.]
Consider:
struct S { const int &i; } s{};
This example ought to be ill-formed, but 9.4.2 [dcl.init.aggr] paragraph 8 states that i is instead initialized from an empty initializer list, which causes i to bind to a value-initialized temporary of type int.
History | |||
---|---|---|---|
Date | User | Action | Args |
2018-02-27 00:00:00 | admin | set | messages: + msg6164 |
2018-02-27 00:00:00 | admin | set | status: open -> c++17 |
2016-06-10 00:00:00 | admin | create |