AA bug..?

Simen Haugen simen at norstat.no
Wed Sep 26 06:00:18 PDT 2007


I dont get it...

I say "int[uint]". Key is of type uint, value is of type int. What does it 
need to check the element types for?

"Vladimir Panteleev" <thecybershadow at gmail.com> wrote in message 
news:op.ty9h4agxm02fvl at irc.irastex.local...
On Wed, 26 Sep 2007 15:49:46 +0300, Simen Haugen <simen at norstat.no> wrote:

>  int[uint] aa1 = [4290904102:1, 1:2]; // This works because 42909... is
> first
>
>  int[uint] aa2 = [1:2, 4290904102:1]; // But here we get the error "cannot
> implicitly convert expression (4290904102L) of type long to int"
>
> Is there something I'm missing, or is this a bug?

An AA literal's types are determined by the first elements. You can use an 
explicit cast to set the literal's type:
int[uint] aa2 = [cast(uint)1:2, 4290904102:1];

-- 
Best regards,
 Vladimir                          mailto:thecybershadow at gmail.com 





More information about the Digitalmars-d mailing list