Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
add unittest example for Issue 16504
Browse files Browse the repository at this point in the history
- fairly synthetic example, but serves as documentation
  • Loading branch information
MartinNowak committed Oct 26, 2016
1 parent ce6aef3 commit 2f3f7c8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/object.d
Original file line number Diff line number Diff line change
Expand Up @@ -3547,3 +3547,19 @@ unittest
S[] arr;
auto a = arr.dup;
}

unittest
{
// Bugzilla 16504
static struct S
{
__gshared int* gp;
int* p;
// postblit and hence .dup could escape
this(this) { gp = p; }
}

int p;
scope arr = [S(&p)];
auto a = arr.dup; // dup does escape
}

0 comments on commit 2f3f7c8

Please sign in to comment.