https://issues.dlang.org/show_bug.cgi?id=24520

timon.g...@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.g...@gmx.ch

--- Comment #2 from timon.g...@gmx.ch ---
https://issues.dlang.org/show_bug.cgi?id=24025

As Steven says:

> An alternative to delaying the C style cast to semantic is to just remove the 
> error.
>
> If a cast from C is desired, then it will work if the type can be constructed 
> with that parameter.
>
> Back when this error was created, something like `int(5)` was not valid code. 
> Now it is. So most cases of casting will just have a failed implicit cast 
> error.
>
> Ironically, this error *hurts* porting C code, instead of helping.

Therefore, I believe the change in behavior with "casts" is intentional.

(int)(c % 8) is just treated as another way to write int(c % 8). Similar to how
`(f)(1, 2)` just means `f(1, 2)`.

I do appreciate that grammar changes make it harder to write code that is
compatible with multiple compiler versions, but I also think testing with
different compiler versions cannot be avoided if one wants to support them.

--

Reply via email to