[phobos] Is this a bug?

Andrei Alexandrescu andrei at erdani.com
Thu Aug 26 23:14:44 PDT 2010


The code should work. I submitted a fix a while ago that allows Variant 
to hold types of any size (internally it uses pointers and dynamic 
allocation).

Did you submit this to bugzilla?

Andrei

On 6/18/10 20:45 PDT, Sean Kelly wrote:
> 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.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list