Andrei Alexandrescu <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #8 from Andrei Alexandrescu <> 2012-10-22 
08:05:52 PDT ---
Consider (assuming A has an int-accepting ctor):

A object = A(1);
// or
auto object = A(1);

In here the name of the type being constructed appears in clear, so there's no
chance for a potential confusion. The code currently works, as it should.


A object = 1;

Again the type being constructed appears in clear. The code works in a function
but not at top level. It is a bug that it doesn't work at top level, because
the equivalent construct A object = A(1) does.

Now consider: 

void fun(A)  { ... }

In here there's no explicit mention of A in the call, which makes this case
qualitatively different from the ones above. Currently the compiler rejects the
code and I think it does very well so. Implicit conversions on function calls
is unrecommended in the presence of function overloading, and essentially C++
made a mistake about it that it has later partially fixed with the "explicit"
keyword. We won't repeat that mistake.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to