D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18926 - Template-related intpromote deprecation message spam
Summary: Template-related intpromote deprecation message spam
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Mac OS X
: P3 normal
Assignee: No Owner
URL: http://dlang.org/
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-31 11:25 UTC by Sophie
Modified: 2024-12-13 18:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sophie 2018-05-31 11:25:57 UTC
I downloaded a newer version of DMD and when I went to compile some code, I got a LOT of intpromote deprecation errors. Many of them repeated for the same line, and in one case it was repeated 300+ times for a single line of code.

This is probably because this particular function gets a lot of different template parameters when running unit tests.

/Users/pineapple/Dropbox/Projects/mach.d/mach/math/bits/inject.d(112): Deprecation: integral promotion not done for -cast(ubyte)bit, use '-transition=intpromote' switch or -cast(int)(cast(ubyte)bit)

This was the function causing the error, due to `-(cast(ubyte) bit)`

/// Inject bit into a value where the bit offset is known at compile time.
/// When the `assumezero` template argument is true, the operation is able
/// to be optimized by assuming the targeted bits are all initialized to 0.
auto injectbit(uint offset, bool assumezero = false, T)(
    T value, in bool bit
) if(
    offset < T.sizeof * 8
){
    enum byteoffset = offset / 8;
    enum bitoffset = offset % 8;
    T target = value;
    auto ptr = cast(ubyte*) &target + byteoffset;
    static if(assumezero){
        *ptr |= cast(ubyte) bit << bitoffset;
    }else{
        *ptr ^= (-(cast(ubyte) bit) ^ *ptr) & (1 << bitoffset);
    }
    return target;
}
Comment 1 dlangBugzillaToGithub 2024-12-13 18:58:57 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19441

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB