Bug 21335 – Compiler implicitly converts array to int[] when it doesn't have to

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-10-21T06:51:35Z
Last change time
2024-12-13T19:12:17Z
Assigned to
No Owner
Creator
Andrej Mitrovic
Moved to GitHub: dmd#19810 →

Comments

Comment #0 by andrej.mitrovich — 2020-10-21T06:51:35Z
----- 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.
Comment #1 by robert.schadek — 2024-12-13T19:12:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19810 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB