The first is called direct-initialization while the second is called copy-initialization. Assuming that Y
has a constructor that takes a X
(or reference to it), direct-initiazliation will call that constructor directly and regardless of whether the constructor is marked as implicit. copy-initialization semantically is equivalent to:
Y y( implicit_conversion<Y>(x) );
That is, the argument is converted by means of an implicit conversion to the destination type and then the copy constructor is called to initialize the variable. In real life, the compiler will remove the copy and convert in place of the destination variable, but the compiler must check that there is an implicit conversion from X
to Y
, and the copy constructor is accessible.