DMD 1.014 release

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Fri Apr 27 01:37:19 PDT 2007


bobef wrote:
> this class member:
> 
> static auto allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
> 
> app.d(126): Error: cannot infer type from this array initializer
> 
> static bool[char[]] allsupportedfiles2=["avi":1,"mpg":1,"mpeg":1,"asf":1,"asx":1,"dat":1,"vob":1,"ifo":1,"wma":1,"wmv":1,"mov":1,"qt":1,"mp4":1,"fli":1,"rm":1,"nuv":1,"ogg":1,"ogm":1,"sdp":1,"pva":1,"roq":1,"flm":1,"cpk":1,"vivo":1,"mkv":1,"mp3":1,"mpe":1,"divx":1,"mpv":1,"m1v":1,"m2v":1,"dv":1,"m4v":1,"264":1,"mp1":1,"mp2":1,"mpa":1,"ac3":1,"m4a":1,"26l":1,"jsv":1,"wav":1/*,"rpl"*/,"flv":1];
> 
> app.d(126): Error: cannot use array to initialize bool[char[]]
> 
> 
> why?

I guess that's what this sentence in the docs means:
=====
An AssocArrayLiteral cannot be used to statically initialize anything.
=====
(Note: The docs aren't up on the site yet, but you can find this in 
dmd/html/d/expression.html#AssocArrayLiteral)

The error message could be clearer.



More information about the Digitalmars-d-announce mailing list