digitalmars.D.bugs - [Issue 20353] New: -checkaction=context does not work well with
- d-bugmail puremagic.com (41/41) Nov 04 2019 https://issues.dlang.org/show_bug.cgi?id=20353
https://issues.dlang.org/show_bug.cgi?id=20353 Issue ID: 20353 Summary: -checkaction=context does not work well with const numbers Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dkorpel live.nl When compiling with -checkaction=context: ```D void main() { const x = -1L; const y = -2L; assert(x == y); } ``` expected: -1 != -2 actual: assert(x == y) failed Also applies to floating points. I don't know why it fails to give context here. Making either x or y mutable makes it work. Also: ```D void main() { const long[1] x = [uint.max]; const long[1] y = [-1]; assert(x == y); } ``` expected: [4294967296] != [-1] actual: [-1] != [-1] This is because in core.internal.dassert: getPrintfFormat there is a check: static if (is(T == long)) This doesn't Unqual T so it doesn't hold when T == const(long), so it chooses the wrong format. --
Nov 04 2019