Common type of ubyte and const ubyte is int
Daniel N
no at public.email
Tue Apr 30 19:32:22 UTC 2024
On Tuesday, 30 April 2024 at 19:23:58 UTC, H. S. Teoh wrote:
> 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
WAT! Thanks for posting this before it bit me!
More information about the Digitalmars-d
mailing list