Created on 2012-08-14.00:00:00 last changed 146 months ago
In determining the implicit conversion sequence for an initializer list argument passed to a reference parameter, the intent is that a temporary of the appropriate type will be created and bound to the reference, as reflected in 12.2.4.2.6 [over.ics.list] paragraph 5:
Otherwise, if the parameter is a reference, see 12.2.4.2.5 [over.ics.ref]. [Note: The rules in this section will apply for initializing the underlying temporary for the reference. —end note]
However, 12.2.4.2.5 [over.ics.ref] deals only with expression arguments, not initializer lists:
When a parameter of reference type binds directly (9.4.4 [dcl.init.ref]) to an argument expression, the implicit conversion sequence is the identity conversion, unless the argument expression has a type that is a derived class of the parameter type, in which case the implicit conversion sequence is a derived-to-base Conversion (12.2.4.2 [over.best.ics])... If the parameter binds directly to the result of applying a conversion function to the argument expression, the implicit conversion sequence is a user-defined conversion sequence (12.2.4.2.3 [over.ics.user]), with the second standard conversion sequence either an identity conversion or, if the conversion function returns an entity of a type that is a derived class of the parameter type, a derived-to-base Conversion.
When a parameter of reference type is not bound directly to an argument expression, the conversion sequence is the one required to convert the argument expression to the underlying type of the reference according to 12.2.4.2 [over.best.ics]. Conceptually, this conversion sequence corresponds to copy-initializing a temporary of the underlying type with the argument expression. Any difference in top-level cv-qualification is subsumed by the initialization itself and does not constitute a conversion.
(Note in particular that the reference binding refers to 9.4.4 [dcl.init.ref], which also does not handle initializer lists, and not to 9.4.5 [dcl.init.list].)
Either 12.2.4.2.5 [over.ics.ref] needs to be revised to handle binding references to initializer list arguments or 12.2.4.2.6 [over.ics.list] paragraph 5 needs to be clearer on how the expression specification is intended to be applied to initializer lists.
History | |||
---|---|---|---|
Date | User | Action | Args |
2012-11-03 00:00:00 | admin | set | status: open -> drafting |
2012-08-14 00:00:00 | admin | create |