[Issue 23743] wrong code with `foreach`, `ubyte`, `>=`, ternary operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 26 15:03:12 UTC 2023


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

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl

--- Comment #1 from Dennis <dkorpel at live.nl> ---
Reduced to avoid `foreach` lowering:

```
void main()
{
    ubyte[] a = [1u];
    ulong i = 0;
    for (;;)
    {
        ubyte x = a[i];
        ubyte v = x >= 1 ? 255 : 0;
        assert(cast(int)v == 255);
    }
}
```

--


More information about the Digitalmars-d-bugs mailing list