[Issue 17978] New: github HEAD gives wrong warning for bitwise uniray opertation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 11 14:39:26 UTC 2017


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

          Issue ID: 17978
           Summary: github HEAD gives wrong warning for bitwise uniray
                    opertation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: puneet at coverify.org

With Github HEAD dmd I get:

$ rdmd --force /tmp/test.d
/tmp/test.d(3): Deprecation: integral promotion not done for ~foo, use
'-transition=intpromote' switch or ~cast(int)(foo)
/tmp/test.d(5): Deprecation: integral promotion not done for -foo, use
'-transition=intpromote' switch or -cast(int)(foo)
/tmp/test.d(6): Deprecation: integral promotion not done for -foo, use
'-transition=intpromote' switch or -cast(int)(foo)


To me it seems that line 5 should result in error since I am trying to coerce
an int into a byte.

void main() {                      // 1
  byte foo;                        // 2
  foo = ~foo;                      // 3
  foo = ~cast(int) (foo);          // 4 -- this should be an error but no
  foo = -foo;                      // 5
  foo = cast(byte) (-foo);         // 6
}

--


More information about the Digitalmars-d-bugs mailing list