Segfault with std.variant

Salih Dincer salihdb at hotmail.com
Sat Mar 25 08:22:04 UTC 2023


On Saturday, 25 March 2023 at 07:42:28 UTC, Ali Çehreli wrote:
>
> This looks like a bug to me.

Such a problem does not occur when you set all objects with the 
new operator.

```d
void main()
{
   import std.variant;

   auto var = Variant([
     "one": new Variant(1), "two": new Variant(2),
     "three": new Variant(3), "four": new Variant(4),
     "five": new Variant(5)
   ]);
   auto six = new Variant(6);
   var["six"] = new Variant(6);
   assert(var.length == 6);
}
```

SDB at 79


More information about the Digitalmars-d-learn mailing list