[Issue 18495] New: Integral promotion for a ~ operator

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 22 15:06:23 UTC 2018


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 at puremagic.com
          Reporter: mrkirushko at 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.

--


More information about the Digitalmars-d-bugs mailing list