Skip to content

Commit

Permalink
Merge pull request #6232 from LemonBoy/cppmangle
Browse files Browse the repository at this point in the history
Fix issue 15576 - Skip over the parent expression when parent is NSpace.
  • Loading branch information
WalterBright committed Nov 6, 2016
2 parents 16afbde + b725551 commit dcb58fc
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cppmangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -1467,7 +1467,12 @@ else static if (TARGET_WINDOS)
buf.writeByte('?');
mangleIdent(d);
assert((d.storage_class & STCfield) || !d.needThis());
if (d.parent && d.parent.isModule()) // static member
Dsymbol parent = d.toParent();
while (parent && parent.isNspace())
{
parent = parent.toParent();
}
if (parent && parent.isModule()) // static member
{
buf.writeByte('3');
}
Expand Down
19 changes: 19 additions & 0 deletions test/runnable/cppa.d
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,24 @@ void testeh3()
}
}

/****************************************/
// 15576

extern (C++, ns15576)
{
extern __gshared int global15576;

extern (C++, ns)
{
extern __gshared int n_global15576;
}
}

void test15576()
{
global15576 = n_global15576 = 123;
}

/****************************************/
// 15579

Expand Down Expand Up @@ -1211,6 +1229,7 @@ void main()
testeh();
testeh2();
testeh3();
test15576();
test15579();
test15610();
test15455();
Expand Down
13 changes: 13 additions & 0 deletions test/runnable/extra-files/cppb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,19 @@ void test15372b()
int t = foo15372<int>(1);
}

/****************************************/
// 15576

namespace ns15576
{
int global15576;

namespace ns
{
int n_global15576;
}
}

/****************************************/
// 15802

Expand Down

0 comments on commit dcb58fc

Please sign in to comment.