Common type of ubyte and const ubyte is int
H. S. Teoh
hsteoh at qfbox.info
Tue Apr 30 19:23:58 UTC 2024
On Tue, Apr 30, 2024 at 06:19:28PM +0000, Steven Schveighoffer via Digitalmars-d wrote:
> ```d
> ubyte a;
> const(ubyte) b;
>
> auto x = true ? a : b;
>
> pragma(msg, typeof(x)); // int
> ```
>
> Why? This isn't a VRP problem, as both are `ubyte`.
>
> Related issue
>
> https://issues.dlang.org/show_bug.cgi?id=19817
[...]
Betcha it's something to do with integer promotion rules.
T
--
Just because you survived after you did it, doesn't mean it wasn't stupid!
More information about the Digitalmars-d
mailing list