Bug 12091 – Possible inconsistency in array literals implicit cast

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-06T16:08:47Z
Last change time
2024-12-13T18:16:40Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: dmd#17638 →

Comments

Comment #0 by bearophile_hugs — 2014-02-06T16:08:47Z
I am not sure, but perhaps this shows an inconsistency worth fixing: long[] foo() { return [1]; // OK } void main() { long[] a; auto b1 = a ~ 0; // OK auto b2 = a ~ [0]; // Error auto c1 = 0 ~ a; // OK auto c2 = [0] ~ a; // Error } dmd 2.065beta2 gives: test.d(7): Error: incompatible types for ((a) ~ ([0])): 'long[]' and 'int[]' test.d(9): Error: incompatible types for (([0]) ~ (a)): 'int[]' and 'long[]'
Comment #1 by robert.schadek — 2024-12-13T18:16:40Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17638 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB