unittest { import std.variant; static struct S { int* p; ubyte[100] u; this(int a) { p = new int(a); } this(this) { p = new int(*p); } ~this() { p = null; } } Variant v = S(4); assert(v.peek!S.p !is null); // fails }
related to https://issues.dlang.org/show_bug.cgi?id=12944
On my computer the static array u can contain up to 24 element to work. Together with the 8 bytes of the pointer this looks like 32 bytes is the magic border.
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9783 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB