Bug 18148 – Integral Promotion Fix For 16997 Should Issue Deprecation, Not A Warning

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-12-31T00:26:24Z
Last change time
2018-01-03T03:08:05Z
Assigned to
No Owner
Creator
Jack Stouffer
See also
https://issues.dlang.org/show_bug.cgi?id=16997

Comments

Comment #0 by jack — 2017-12-31T00:26:24Z
We've had this discussion before on the forums but I think it needs to be restated: Using a warning as part of the deprecation cycle is a poor choice because the majority of build setups (including DUB) have "warnings as errors" set by default (this is the sensible thing to do). This means that you're breaking people's code on step one of the cycle. Instead, this should issue a deprecation message, then a warning, then an error.
Comment #1 by schveiguy — 2017-12-31T12:06:28Z
Fixed typo in title. Reading all the history for 16997, it appears that the resulting intent was for it to be a deprecation. Specifically this comment from Walter: https://github.com/dlang/dmd/pull/7013#issuecomment-338364465 Is it not true?
Comment #2 by jack — 2017-12-31T14:56:55Z
(In reply to Steven Schveighoffer from comment #1) > Fixed typo in title. > > Reading all the history for 16997, it appears that the resulting intent was > for it to be a deprecation. Specifically this comment from Walter: > https://github.com/dlang/dmd/pull/7013#issuecomment-338364465 > > Is it not true? According to the changelog a warning is issued if one of the switches is not given https://dlang.org/changelog/2.078.0.html#fix16997
Comment #3 by schveiguy — 2017-12-31T15:15:28Z
The changelog is wrong. Stevens-MacBook-Pro:testd steves$ cat testint.d import std.stdio; void main() { byte b = -128; writeln(-b); } Stevens-MacBook-Pro:testd steves$ ~/Downloads/dmd2/osx/bin/dmd testint.d testint.d(6): Deprecation: integral promotion not done for -b, use '-transition=intpromote' switch or -cast(int)(b) Stevens-MacBook-Pro:testd steves$ ./testint -128 Stevens-MacBook-Pro:testd steves$ rm testint Stevens-MacBook-Pro:testd steves$ ~/Downloads/dmd2/osx/bin/dmd -w testint.d testint.d(6): Deprecation: integral promotion not done for -b, use '-transition=intpromote' switch or -cast(int)(b) Stevens-MacBook-Pro:testd steves$ ./testint -128 Stevens-MacBook-Pro:testd steves$ ~/Downloads/dmd2/osx/bin/dmd -transition=intpromote testint.d Stevens-MacBook-Pro:testd steves$ ./testint 128 So without any switches, we get a deprecation, not a warning. With the switches, we get the new behavior. In no case does it fail to compile. So I think this is really a changelog issue. Since this is trivial to fix, and the real behavior is what you desired, I suggest just doing a PR on dlang.org, no need for a bug report.
Comment #4 by github-bugzilla — 2017-12-31T19:18:11Z
Commit pushed to MartinNowak-patch-1 at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/35be0df5b58c0e9053dcae2bea658b5b3fcab397 fix changlog entry see Issue 18148
Comment #5 by code — 2017-12-31T19:19:44Z
Comment #6 by github-bugzilla — 2017-12-31T21:02:20Z
Comment #7 by jack — 2018-01-01T01:37:38Z
I've been away from the computer for the whole day, so thanks to everyone who fixed this.
Comment #8 by github-bugzilla — 2018-01-03T03:08:05Z