Bug 15080 – extern(C++) classes have wrong static data layout

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-09-17T15:00:00Z
Last change time
2015-09-18T01:25:10Z
Keywords
C++, pull, wrong-code
Assigned to
yebblies
Creator
yebblies

Comments

Comment #0 by yebblies — 2015-09-17T15:00:29Z
import core.stdc.stdio; extern(C++) class C { uint x = 1; uint y = 2; void func() {} } extern(C++) class D : C { uint z = 3; override void func() {} } __gshared D c = new D(); void main() { printf("%u\n", c.x); printf("%u\n", c.y); printf("%u\n", c.z); } The offsets are wrong because dmd assumes there is always a monitor word.
Comment #1 by yebblies — 2015-09-17T15:06:18Z
Comment #2 by github-bugzilla — 2015-09-18T01:25:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f4fe25e2ec14a6a6950a327f9406a6f3ea74bc73 Fix Issue 15080 - extern(C++) classes have wrong static data layout https://github.com/D-Programming-Language/dmd/commit/4ce03bc280835f2ed86648a4b91364c23a70e5d3 Merge pull request #5096 from yebblies/issue15080 Issue 15080 - extern(C++) classes have wrong static data layout