Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-transition=intpromote deprecation message confusing #17834

Open
dlangBugzillaToGithub opened this issue Jan 26, 2018 · 2 comments
Open

-transition=intpromote deprecation message confusing #17834

dlangBugzillaToGithub opened this issue Jan 26, 2018 · 2 comments

Comments

@dlangBugzillaToGithub
Copy link

Timothee Cour (@timotheecour) reported this on 2018-01-26T21:40:49Z

Transferred from https://issues.dlang.org/show_bug.cgi?id=18307

CC List

  • Zach the Mystic

Description

see https://github.com/msgpack/msgpack-d/pull/99/files/728edb1d58c8e027adf5740e3fbcf425639710c4#r164228277 for context.

dmd.2_078_1/.dub/packages/msgpack-d-1.0.0-beta.6/msgpack-d/src/msgpack/unpacker.d(199,30): Deprecation: integral promotion not done for -header, use '-transition=intpromote' switch or -cast(int)(header)

* should that be -int(header) instead of -cast(int)(header) ?
* could dmd also report the type of `header` since it already knows about it?
@dlangBugzillaToGithub
Copy link
Author

reachzach commented on 2018-04-15T02:48:20Z

I tested it and this works:

// change this:
// value = -(cast(T)-header);

// to this:
value = cast(T)cast(byte)header;

header is a ubyte. When changed to a byte, in this context, it becomes negative. The compiler then creates a corresponding negative int.

@dlangBugzillaToGithub
Copy link
Author

reachzach commented on 2018-04-15T02:50:14Z

...or whatever negative Integral type it requires. (I did only test it with `int`, but I think it should work regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants