https://issues.dlang.org/show_bug.cgi?id=20433
RazvanN <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from RazvanN <[email protected]> --- I think that the error messages are fine. When someone sees "cannot implicitly convert expression [1] of type int[] to Thing", I would argue that the first think that comes to mind is "Holy Crap, I tried to put an array of ints into a Thing type, the correct thing to do is Thing a = Thing(1);". Let's just assume that my supposition is false and the majority of people think "oh, it wants me to explicitly cast the int array to a Thing" (?!?!?!), then if you explicitly cast it you get an error message that it is impossible. Now you are left with no other option than to try instantiating a Thing with a Thing (which is the correct behavior). As for the situation with both implicit conversions and casts: if you have a situation where both fail, the compiler will highlight one at a time, so your scenario is not possible. Example: struct Thing { int x; } struct A {} void main() { A a = cast(Thing) [1]; } Error: cannot cast expression [1] of type int[] to Thing This behavior is fine and I suggest we close as this INVALID. --
