Bug 18349 – std/math.d(543,33): Deprecation: integral promotion not done for -x

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-02-01T08:46:40Z
Last change time
2020-03-21T03:56:40Z
Keywords
pull
Assigned to
No Owner
Creator
Timothee Cour

Comments

Comment #0 by timothee.cour2 — 2018-02-01T08:46:40Z
/Users/timothee/homebrew/opt/dmd/include/dlang/dmd/std/math.d(543,33): Deprecation: integral promotion not done for -x, use '-transition=intpromote' switch or -cast(int)(x) dub run dfmt -- -h Building package dfmt in /Users/timothee/.dub/packages/dfmt-0.5.0/dfmt/ Fetching libdparse 0.7.1 (getting selected version)... Performing "debug" build using dmd for x86_64. libdparse 0.7.1: building configuration "library"... dfmt 0.5.0: building configuration "application"... /Users/timothee/homebrew/opt/dmd/include/dlang/dmd/std/math.d(543,33): Deprecation: integral promotion not done for -x, use '-transition=intpromote' switch or -cast(int)(x) /Users/timothee/homebrew/opt/dmd/bin/dmd --version DMD64 D Compiler v2.078.1
Comment #1 by timothee.cour2 — 2018-02-07T00:26:54Z
IIRC: was triggered from dfmt by an input of type `immutable(short)` looks like logic breaks when input is immutable? Num abs(Num)(Num x) @safe pure nothrow if ((is(typeof(Num.init >= 0)) && is(typeof(-Num.init)) || (is(Num == short) || is(Num == byte))) && !(is(Num* : const(ifloat*)) || is(Num* : const(idouble*)) || is(Num* : const(ireal*)))) { static if (isFloatingPoint!(Num)) return fabs(x); else { static if (is(Num == short) || is(Num == byte)) return x >= 0 ? x : cast(Num) -int(x); else return x >= 0 ? x : -x; } }
Comment #2 by b2.temp — 2018-02-07T08:55:28Z
Yeah nobody seen that "Unqual" is needed during the review. https://github.com/dlang/phobos/pull/5958/files I'm gonna handle this since i feel 50% responsible
Comment #3 by b2.temp — 2018-02-07T09:04:40Z
Comment #4 by b2.temp — 2018-02-07T09:12:02Z
Comment #5 by github-bugzilla — 2018-02-07T20:06:38Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/a2ab91ad483a18c277490fe2a6d725054ad39584 fix issue 18349 - std/math.d(543,33): Deprecation: integral promotion not done for -x https://github.com/dlang/phobos/commit/9087e479618a2ad75960569cabfa75ce09255fd7 Merge pull request #6135 from BBasile/issue-18349 fix issue 18349 - std/math.d(543,33): Deprecation: integral promotion not done for -x merged-on-behalf-of: Steven Schveighoffer <[email protected]>