
9 Feb
2004
9 Feb
'04
4:33 p.m.
Peter Dimov wrote:
Howard Hinnant wrote:
Reasoning:
foo(A());
expands to:
foo(A(A()));
No, it expands to
typedef A const CA; foo(CA(A()));
The difference is that a const_cast<A&> inside foo is now undefined behavior (whereas a direct binding would've made it legal.)
However (apologies for the follow up to self) the rest of Howard's analysis still seems to apply, i.e. the CA temporary is created with A::A(A&&), and the A const & parameter of foo is bound directly to that temporary (if not elided).