digitalmars.D.bugs - [Issue 17639] New: std.math.approxEqual accepts return of isNaN
- via Digitalmars-d-bugs (30/30) Jul 12 2017 https://issues.dlang.org/show_bug.cgi?id=17639
https://issues.dlang.org/show_bug.cgi?id=17639 Issue ID: 17639 Summary: std.math.approxEqual accepts return of isNaN (bool) as argument Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: drug2004 bk.ru Found by typo, forget to remove `isNaN` and code still compiles giving wrong result: ``` import std.math; int main() { float a = 0, b = 10_000; static assert (!__traits(compiles, q{ // isNaN wasn't removed during copy-paste // but code still compiles with wrong result assert (a.approxEqual(b.isNaN) == false); }), "This code must not compile!"); return 0; } ``` --
Jul 12 2017