[Issue 23743] New: wrong code with `foreach`, `ubyte`, `>=`, ternary operator
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 26 12:42:52 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23743
Issue ID: 23743
Summary: wrong code with `foreach`, `ubyte`, `>=`, ternary
operator
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ag0aep6g at gmail.com
void main()
{
ubyte[] a = [1];
foreach (x; a)
{
ubyte v = x >= 1 ? 255 : 0;
assert(v == 255); /* fails; should pass */
}
}
dmd2.102.1, Windows, -m64: fail
dmd2.102.1, Windows, -m32: pass
dmd2.102.1, Windows, -m32mscoff: pass
run.dlang.io, all dmd versions (2.062, ..., 2.101.2): fail
run.dlang.io, ldc: pass
--
More information about the Digitalmars-d-bugs
mailing list