I am currently trying to understand the new uniform initialization of C++0x. Unfortunately, I stumpled over using uniform initialization of references. Example:
According to N2672 the paragraph 8.5.4.4 should say:
Otherwise, if T is a reference type, an rvalue temporary of the type referenced by T is list-initialized, and the reference is bound to that temporary. [ Note: As usual, the binding will fail and the program is ill-formed if the reference type is an lvalue reference to a non-const type. ]
which (if I understand it correctly) means uniform initialization of references binds them to new anonymous instances, so it seems to me it's pretty useless. That still does not explain why one works and the other does not; they should behave the same (unless Y
has some explicit constructors).