www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17978] New: github HEAD gives wrong warning for bitwise

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 puremagic.com
          Reporter: puneet 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
}

--
Nov 11