This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-12-20
[Voted into WP at October, 2009 meeting.]
According to 9.5.5 [dcl.init.list] paragraph 3,
Otherwise, ifT is a reference type, an rvalue temporary ofthe type referenced byT is list-initialized, and thereference is bound to that temporary.
This means, for an example like
int i; const int& r1{ i }; int&& r2{ i };r1 is bound to a temporary containing the value ofi, not toi itself, which seems surprising. Also,there's no prohibition here against binding the rvalue reference to anlvalue, as there is in 9.5.4 [dcl.init.ref] paragraph 5 bullet2, so the initialization ofr2 is well-formed, even thoughthe corresponding non-list initializationint&& r3(i)is ill-formed.
There's also a question as to whether this bullet even applies tothese examples. According to the decision tree in 9.5 [dcl.init] paragraph 16, initialization of a reference is dispatchedto 9.5.4 [dcl.init.ref] in the first bullet, so these casesnever make it to the third bullet sending the remainingbraced-init-list cases to 9.5.5 [dcl.init.list]. If that's thecorrect interpretation, there's a problem with 9.5.4 [dcl.init.ref], since it doesn't deal with thebraced-init-listcases, and the bullet in 9.5.5 [dcl.init.list] paragraph 3dealing with references is dead code that's never used.
Proposed resolution (July, 2009):
Move the third bullet of the list in 9.5 [dcl.init] paragraph 16to the top of the list:
If the initializer is abraced-init-list, theobject is list-initialized (9.5.5 [dcl.init.list]).
If the destination type is a reference type, see 9.5.4 [dcl.init.ref].
...
Change 9.5.5 [dcl.init.list] paragraph 3, bullets 4 and 5,as follows:
Otherwise, ifT is a referenceto classtype,or ifT is any reference type and the initializerlist has no elements, an rvalue temporary of the type referencedbyT is list-initialized, and the reference is bound to thattemporary. [Note:...
Otherwise (i.e., ifT is not an aggregate, classtype, or reference), if the initializer list has a singleelement...