Created on 2010-07-29.00:00:00 last changed 171 months ago
Rationale (November, 2010):
The restriction is intentional. Support for aggregate initialization is principally intended for legacy code and C compatibility, not for code written using the new facilities of the language.
The current wording of the WP allows aggregate initialization of parameters in function calls. For example, 12.2.4.2.6 [over.ics.list] paragraph 4 reads:
Otherwise, if the parameter has an aggregate type which can be initialized from the initializer list according to the rules for aggregate initialization (9.4.2 [dcl.init.aggr]), the implicit conversion sequence is a user-defined conversion sequence. [Example:
struct A { int m1; double m2; }; void f(A); f( {'a', 'b'} ); // OK: f(A(int,double)) user-defined conversion f( {1.0} ); // error: narrowing—end example]
The rules for aggregate initialization in 9.4.2 [dcl.init.aggr] paragraph 11 allow braces to be elided in the initializer
In a declaration of the form
T x = { a };
It is not clear whether this phrasing should be interpreted as allowing brace elision only in a simple-declaration and thus not in a function argument or whether this restriction is inadvertent and should be removed.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-11-29 00:00:00 | admin | set | messages: + msg3216 |
2010-11-29 00:00:00 | admin | set | status: open -> nad |
2010-07-29 00:00:00 | admin | create |