[Issue 21335] New: Compiler implicitly converts array to int[] when it doesn't have to

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 21 06:51:35 UTC 2020


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

          Issue ID: 21335
           Summary: Compiler implicitly converts array to int[] when it
                    doesn't have to
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com

-----
enum OP : ubyte
{
    PUSH = 2
}

void take (ubyte[]) { }

void main ()
{
    ubyte[2] bytes;
    take([OP.PUSH, bytes[0]]);  // ok
    take([bytes[0]] ~ bytes);   // ok
    take([OP.PUSH, bytes[0]] ~ bytes);  // error. promotion to int[]?!
}
-----

Why is it promoting `OP.PUSH` into an integer in the last call? It makes
absolutely no sense at all.

--


More information about the Digitalmars-d-bugs mailing list