D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1048 - the type matching of static initialization
Summary: the type matching of static initialization
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 major
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2007-03-10 00:50 UTC by Wei Li
Modified: 2014-02-16 15:22 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Wei Li 2007-03-10 00:50:28 UTC
The following code will cause a error: 
Error: cannot implicitly convert expression ([2,3,4]) of type int[3] to ubyte


ubyte a[3] = [2, 3 ,4];
Comment 1 Derek Parnell 2007-03-10 03:41:40 UTC
That worked for me.

Windows XP SP2, DMD 1.007

-----------------

c:\temp>type test.d
ubyte a[3] = [2, 3 ,4];
void main(){}
c:\temp>dmd test.d
c:\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi;

c:\temp>dmd
Digital Mars D Compiler v1.007
---------------
Comment 2 Wei Li 2007-03-10 08:51:42 UTC
It cannot works:

void main(){
ubyte a[3] = [2, 3 ,4];
}

Comment 3 Don 2009-09-04 06:22:30 UTC
This was still failing in DMD1.020, but was fixed by 1.041.