Skip to content

Commit

Permalink
Added unittests for fixed std.typecons.scoped initialization issue.
Browse files Browse the repository at this point in the history
* issue fixed in commit 2840e44
  • Loading branch information
denis-sh committed Oct 28, 2012
1 parent 3e0f69c commit 95c5ba3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions std/typecons.d
Expand Up @@ -3132,15 +3132,17 @@ unittest // Issue 6580 testcase
{
long l; byte b = 4;
this() { }
this(long _l) { l = _l; }
this(long _l, ref int i) { l = _l; ++i; }
}
static class C2long { byte[2] b = [5, 6]; long l = 7; }
static assert(scoped!C1long().sizeof % longAlignment == 0);
static assert(scoped!C2long().sizeof % longAlignment == 0);

void alignmentTest()
{
auto c1long = scoped!C1long(3);
int var = 5;
auto c1long = scoped!C1long(3, var);
assert(var == 6);
auto c2long = scoped!C2long();
assert(cast(size_t)&c1long.l % longAlignment == 0);
assert(cast(size_t)&c2long.l % longAlignment == 0);
Expand Down

0 comments on commit 95c5ba3

Please sign in to comment.