[Issue 15605] New: Invalid result of ptrdiff_t comparison.
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jan 25 09:15:13 PST 2016
https://issues.dlang.org/show_bug.cgi?id=15605
Issue ID: 15605
Summary: Invalid result of ptrdiff_t comparison.
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: keepitsimplesirius at gmail.com
import std.stdio;
void func(size_t w, size_t h) {
ptrdiff_t a = h / 2;
ptrdiff_t b = h / 2;
writeln(-a, " ", -a + w);
writeln(-a < -a + w);
}
int main() {
func(3, 3);
return 0;
}
Outputs:
-1 2
false
Should:
-1 2
true
Compiler:
DMD64 D Compiler v2.069.2
Copyright (c) 1999-2015 by Digital Mars written by Walter Bright
--
More information about the Digitalmars-d-bugs
mailing list