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: [email protected]
Reporter: [email protected]
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
--