www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18495] New: Integral promotion for a ~ operator

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

          Issue ID: 18495
           Summary: Integral promotion for a ~ operator
           Product: D
           Version: D2
          Hardware: x86
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: mrkirushko ya.ru

As far as I understand, according to the manual
(https://dlang.org/spec/expression.html#complement_expressions) the bitwise
invertion operator should give a result of the same type as of its operand. But
the code " ubyte d1 = 10; ubyte d2; d2 = ~d1; " gives a strange " Deprecation:
integral promotion not done for '~d1', use '-transition=intpromote' switch or
'~cast(int)d1' " message when compiled.

None of the C compilers I ever used had any issues with that as well. They just
compile with no warnings or errors.

The code compiles and works as expected so it is not a major issue.

--
Feb 22 2018