Title
Nested braces in list-initialization
Status
nad
Section
9.4.5 [dcl.init.list]
Submitter
Steve Adamczyk

Created on 2012-05-04.00:00:00 last changed 139 months ago

Messages

Date: 2012-10-15.00:00:00

Rationale (October, 2012):

The wording “a single element of type E” excludes the case of a nested braced initializer, because such an element has no type.

Date: 2022-11-20.07:54:16

The specification of list-initialization in 9.4.5 [dcl.init.list] paragraph 3 has a bullet that reads,

Otherwise, if the initializer list has a single element of type E and either T is not a reference type or its referenced type is reference-related to E, the object or reference is initialized from that element

It is not clear what is meant by being “ initialized from the element.” If one assumes that it means “go back to 9.4 [dcl.init] and follow the logic ladder there with the element,” the logical result is that an initializer for a scalar could be arbitrarily deeply nested in braces, with each trip through the 9.4 [dcl.init] / 9.4.5 [dcl.init.list] recursion peeling off one layer. Presumably that is not intended.

History
Date User Action Args
2012-11-03 00:00:00adminsetmessages: + msg4179
2012-11-03 00:00:00adminsetstatus: open -> nad
2012-05-04 00:00:00admincreate