Bug 20360 – std.variant doesn't do postblit/dtor correctly for large structs

Status
NEW
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-11-06T12:00:44Z
Last change time
2024-12-01T16:35:58Z
Keywords
industry
Assigned to
No Owner
Creator
John Colvin
Moved to GitHub: phobos#9783 →

Comments

Comment #0 by john.loughran.colvin — 2019-11-06T12:00:44Z
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 }
Comment #1 by john.loughran.colvin — 2019-11-06T12:02:42Z
Comment #2 by bugzilla — 2020-01-05T19:06:57Z
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.
Comment #3 by robert.schadek — 2024-12-01T16:35:58Z
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