Bug 9295 – More implicit type conversion in array literals

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-11T10:50:50Z
Last change time
2024-12-13T18:03:38Z
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: dmd#17568 →

Comments

Comment #0 by bearophile_hugs — 2013-01-11T10:50:50Z
I think this code should compile: void main() { auto vec = [1.0, 2]; // OK auto mat = [[1.0], [2]]; // error } Currently dmd v.2.062alpha gives: test.d(3): Error: incompatible types for (([1]) ? ([2])): 'double[]' and 'int[]' A person on IRC has suggested that in some cases this is not what you want. Please add some of such examples below.
Comment #1 by robert.schadek — 2024-12-13T18:03:38Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17568 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB