Segfault with std.variant
Ali Çehreli
acehreli at yahoo.com
Sat Mar 25 07:42:28 UTC 2023
On 3/24/23 23:07, Mitchell wrote:
> variant["four"] = Variant(4); // Segfault
Today I learned that VariantN forwards to associative array operations.
Cool I guess. :)
> with a segfault. I'm using LDC2:
Same with dmd. It fails in the destructor of VariantN.
static if (!AllowedTypes.length ||
anySatisfy!(hasElaborateDestructor, AllowedTypes))
{
~this()
{
// Infer the safety of the provided types
static if (AllowedTypes.length)
{
if (0)
{
AllowedTypes var;
}
}
(() @trusted => fptr(OpID.destruct, &store, null))();
}
}
That @trusted lambda call segfaults.
This looks like a bug to me. Reported:
https://issues.dlang.org/show_bug.cgi?id=23809
Ali
More information about the Digitalmars-d-learn
mailing list