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.