[phobos] Is this a bug?

Sean Kelly sean at invisibleduck.org
Fri Jun 18 20:45:33 PDT 2010


More compact:

    import std.variant;
    import std.typecons;

    struct Val
    {
        Variant v;
        Object  o;
    }

    void main()
    {
        alias Tuple!(Val) Wrap;
        Wrap    wrap;
        Variant data;
        Val     val;

        wrap.field[0] = val;
        data = wrap;
    }

I think it's simply a bug with the static checking in the opAssign for Variant.  It should reject the value as too large, but instead it accepts it and explodes.  When I pass a Val* the code compiles fine.


More information about the phobos mailing list