Bug? Can't init an AA of different-length strings

Nick Sabalausky a at a.a
Sat Oct 4 02:16:50 PDT 2008


I'd put this into Bugzilla, but I wanted to check first if there was 
something I was misunderstanding:

void main()
{
    // Ok
    char[][] strsA = ["333", "22", "4444"];

    // Ok
    char[][char] strsB = ['3':"333", '2':"222", '4':"444"];

    // Ok
    char[][char] strsC;
    strsC['3'] = "333";
    strsC['2'] = "22";
    strsC['4'] = "4444";

    // Error: cannot implicitly convert expression ("22") of type char[2u] 
to char[3u]
    // Error: cannot implicitly convert expression ("4444") of type char[4u] 
to char[3u]
    char[][char] strsD = ['3':"333", '2':"22",  '4':"4444"];
}

On that last one, strsD, the compiler seems to interpret it as 
"char[lengthOfFirstStringLiteral][char]", in this case, "char[3][char]", 
instead of using char[][char]. Is this really supposed to be happening, or 
is it a bug? 




More information about the Digitalmars-d-learn mailing list