[Issue 18148] Integral Promotion Fix For 16997 Should Issue Deprecation, Not A Warning

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Dec 31 15:15:28 UTC 2017


https://issues.dlang.org/show_bug.cgi?id=18148

--- Comment #3 from Steven Schveighoffer <schveiguy at yahoo.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list