Skip to content

Commit

Permalink
Fix terrible std.typecons.scoped bug
Browse files Browse the repository at this point in the history
For misaligned buffer it emplaces object to incorrect memory location.
  • Loading branch information
denis-sh committed Oct 27, 2012
1 parent dab3b2a commit 9cf123a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion std/typecons.d
Expand Up @@ -3109,7 +3109,8 @@ unittest
}

Scoped!T result;
emplace!(Unqual!T)(cast(void[])result.Scoped_store, args);
immutable size_t d = cast(void*) result.Scoped_payload - result.Scoped_store.ptr;
emplace!(Unqual!T)(result.Scoped_store[d .. $], args);
return result;
}

Expand Down

0 comments on commit 9cf123a

Please sign in to comment.