I was under the impression that associative arrays now used ?: to find the best type for the array? Or was this change only made in D2? The following:
----
void main()
{
    auto foo = [ 2 : "a", 3 : "ab" ];
}
----
Gives the error:
----
test.d(3): Error: cannot implicitly convert expression ("ab") of type char[2LU] to char[1LU] test.d(3): Error: cannot implicitly convert expression ([2:"a",3:__error]) of type char[1LU][int] to char[1LU][int]
----
When using D1. This means that some of my code that should be constant needs to be initialised at runtime (the only way around this seems to be to change "a" to "a"[], and apparently strings can't be []'d at compile time). Is there any way around this in D1, or is this a bug?

--
Robert
http://octarineparrot.com/

Reply via email to