[Issue 2451] Cannot add a Variant to associative array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 22 07:39:44 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2451





------- Comment #1 from andrei at metalanguage.com  2009-02-22 09:39 -------
(In reply to comment #0)
> import std.variant;
> 
> void main()
> {
>     Variant[string] a;
>     Variant v = 1;
>     a["wut?"] = v;
> }
> ----
> core.exception.ArrayBoundsException at Test(23): Array index out of bounds
> 
> Key type is irrelevant.
> 

I reduced this further:

struct Wyda
{
    void opAssign(Wyda) {assert(&this !is null);}
}

void main()
{
    Wyda[int] a;
    a[4] = Wyda();
}

The assert will fail! Hash tables for value types that define opAssign seem to
have a problem.


-- 



More information about the Digitalmars-d-bugs mailing list