Common type of ubyte and const ubyte is int

Timon Gehr timon.gehr at gmx.ch
Tue Apr 30 21:18:36 UTC 2024


On 4/30/24 20:19, Steven Schveighoffer 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
> 
> -Steve

FWIW, my frontend says `ubyte` here and there is a comment somewhere 
that claims it implements some rules from TDPL page 60.


More information about the Digitalmars-d mailing list