D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6580 - scoped classes are aligned incorrectly
Summary: scoped classes are aligned incorrectly
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-30 12:20 UTC by Christian Kamm
Modified: 2012-05-09 00:06 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Christian Kamm 2011-08-30 12:20:10 UTC
Test case:

import std.typecons;

class C { int i; byte b; }

void main()
{
  auto sa = [scoped!C, scoped!C];
  assert(cast(size_t)&sa[0].i % int.alignof == 0);
  assert(cast(size_t)&sa[1].i % int.alignof == 0); // fails
}

The problem is that the payload is declared as
private ubyte[__traits(classInstanceSize, T)] Scoped_store = void;
in std.typecons.scoped, as discussed at https://github.com/D-Programming-Language/phobos/pull/148#issuecomment-1590157 .
Comment 1 Denis Shelomovskii 2012-05-04 12:39:57 UTC
https://github.com/D-Programming-Language/phobos/pull/570
Comment 2 github-bugzilla 2012-05-08 23:43:01 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/2503b18d1c6bba9e697e6eb0bf1914a65acdf215
Fix Issue 6580 - scoped classes are aligned incorrectly

https://github.com/D-Programming-Language/phobos/commit/84218d3e1ebe5efb04b64e121a27870184334f84
Merge pull request #570 from denis-sh/scoped-bug6580-fix

Fix Issue 6580 - scoped classes are aligned incorrectly