Re: Compiler chooses conv ctor - why?
 
"Cezary H. Noweta" wrote:
4. According to 13.3.3[1] we start at checking of parameter 
conversion sequences, when selecting the best function. A 
parameter of conv ctor is ,,const A&'', and implicit object 
parameter of conv foo is ,,const A&'' too. Both of functions 
require the same qualification conversion, thus both of them are 
indistinguishable from each other.
Your analysis is correct. All I can add is that 13.3.1.4/2 
reiterates what is said in 13.3.3/1:
<quote>
Note: this argument will be compared against the first parameter 
of the constructors and against the implicit object parameter of 
the conversion functions.
</quote>
Actually, it's a long-standing bug in VC++ that direct 
initialization is not distinguished from copy initialization. The 
following code demonstrates it:
struct Y {};
class X
{
public:
    X() {}
    X(Y) {}
private:
    X(const X&);
};
int main()
{
    Y y;
    X x1 = y; // ill-formed, inaccessible cctor
    X x2(y); // OK, direct initialization
    return 0;
}
According to the standard `x1' instance cannot be constructed due 
to inaccessible copy constructor (which may be eliminated during 
construction of an object by the compiler, but the copy semantics 
must be preserved anyway).
Alex