mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 14:10:30 +03:00
fix issue 10017
This commit is contained in:
parent
d7d90c7749
commit
2dba41d032
1 changed files with 20 additions and 0 deletions
|
@ -299,6 +299,12 @@ private:
|
|||
case OpID.copyOut:
|
||||
auto target = cast(VariantN *) parm;
|
||||
assert(target);
|
||||
|
||||
static if (target.size < A.sizeof)
|
||||
{
|
||||
if (target.type.tsize < A.sizeof)
|
||||
*cast(A**)&target.store = new A;
|
||||
}
|
||||
tryPutting(zis, typeid(A), cast(void*) getPtr(&target.store))
|
||||
|| assert(false);
|
||||
target.fptr = &handler!(A);
|
||||
|
@ -1881,3 +1887,17 @@ unittest
|
|||
assert(a == b);
|
||||
assert(b == a);
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
// http://d.puremagic.com/issues/show_bug.cgi?id=10017
|
||||
static struct S
|
||||
{
|
||||
ubyte[Variant.size + 1] s;
|
||||
}
|
||||
|
||||
Variant v1, v2;
|
||||
v1 = S(); // the payload is allocated on the heap
|
||||
v2 = v1; // AssertError: target must be non-null
|
||||
assert(v1 == v2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue