digitalmars.D.bugs - [Issue 22715] New: compiler should issue warning when passing D:long
- d-bugmail puremagic.com (40/40) Jan 30 2022 https://issues.dlang.org/show_bug.cgi?id=22715
https://issues.dlang.org/show_bug.cgi?id=22715 Issue ID: 22715 Summary: compiler should issue warning when passing D:long as c_long to func. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: mingwu gmail.com $ cat ldiv.d import std.stdio; import core.stdc.stdlib; void main() { long m = 24; long n = 111; ldiv_t qr = core.stdc.stdlib.ldiv(m, n); writeln(qr); assert(qr.quot == 0); assert(qr.rem == 24); } $ dmd ldiv.d $ ./ldiv ldiv_t(0, 0) core.exception.AssertError ldiv.d(10): Assertion failure ---------------- ??:? _d_assertp [0x559c0455105d] ??:? _Dmain [0x559c045404f2] of course, using lldiv(), we get the correct result: lldiv_t(0, 24) but: 1) the compiler should generate warning message, when user passing D:long as c_long to ldiv(). 2) both m and n in the above are small ints, even passing as long, why the result is wrong? is there another hidden bug somewhere? --
Jan 30 2022