[cfe-dev] interesting c++ puzzle

dawn at burble.org dawn at burble.org
Thu Jan 31 11:36:29 PST 2013


> IIRC, according to the standard, this
>   B b = f(1);
> is equivalent to
>   B b(f(1));

Perhaps someone mentioned it already, but it should be pointed out that
these are not in fact equivalent. 

>   B b = f(1);
uses copy initialization

>   B b(f(1));
uses direct initialization

The rules for each are different.  I haven't looked at the complete test
cases so not sure if that actually makes a difference in this case.

-Dawn



More information about the cfe-dev mailing list