Skip to content

Commit

Permalink
Merge pull request #5096 from yebblies/issue15080
Browse files Browse the repository at this point in the history
Issue 15080 - extern(C++) classes have wrong static data layout
  • Loading branch information
9rnsr committed Sep 18, 2015
2 parents 6d5bf8a + f4fe25e commit 4ce03bc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/todt.c
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ dt_t **ClassReferenceExp_toInstanceDt(ClassReferenceExp *ce, dt_t **pdt)
ClassDeclaration *cd = ce->originalClass();

pdt = dtxoff(pdt, toVtblSymbol(cd), 0);
pdt = dtsize_t(pdt, 0); // monitor
if (!cd->cpp)
pdt = dtsize_t(pdt, 0); // monitor

// Put in the rest
size_t firstFieldIndex = 0;
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/xtest46.d
Original file line number Diff line number Diff line change
Expand Up @@ -3911,6 +3911,22 @@ void test2486()
static assert(!__traits(compiles, foo(s[]))); // should be NG
}

/***************************************************/

extern(C++) class C15080
{
uint x = 1;
uint y = 2;
}

__gshared c15080 = new C15080();

void test15080()
{
assert(c15080.x == 1);
assert(c15080.y == 2);
}

/***************************************************/
// 2521

Expand Down Expand Up @@ -7938,6 +7954,7 @@ int main()
test10542();
test10539();
test10634();
test15080();
test7254();
test13468();
test11075();
Expand Down

0 comments on commit 4ce03bc

Please sign in to comment.