Bug 8277 – Missed implicit cast with fixed size array

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-06-21T12:11:54Z
Last change time
2024-12-13T18:00:35Z
Keywords
rejects-valid
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: dmd#18452 →

Comments

Comment #0 by bearophile_hugs — 2012-06-21T12:11:54Z
void main() { int[2][] data1; data1.length++; int[2] r1 = true ? data1[0] : [0, 0]; // OK, no cast needed int[2][][] data2; data2.length++; int[2][] r2 = true ? data2[0] : [cast(int[2])[0, 0]]; // OK int[2][] r3 = true ? data2[0] : [[0, 0]]; // error int[2][][][] data3; data3.length++; int[2][][] r4 = true ? data3[0] : [[cast(int[2])[0, 0]]]; // OK int[2][][] r5 = true ? data3[0] : [[[0, 0]]]; // error } DMD 2.060alpha: test.d(9): Error: incompatible types for ((data2[cast(uint)0]) ? ([[0,0]])): 'int[2u][]' and 'int[][]' test.d(14): Error: incompatible types for ((data3[cast(uint)0]) ? ([[[0,0]]])): 'int[2u][][]' and 'int[][][]'
Comment #1 by robert.schadek — 2024-12-13T18:00:35Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18452 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB