Skip to content

Commit

Permalink
Merge pull request #7906 from WalterBright/fix17772part1
Browse files Browse the repository at this point in the history
correct namespace mangling for Issue 17772
merged-on-behalf-of: Iain Buclaw <ibuclaw@gdcproject.org>
  • Loading branch information
dlang-bot authored Feb 28, 2018
2 parents 73490f2 + 5bb9d29 commit 9bed5b4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/dmd/cppmangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,20 @@ private final class CppMangleVisitor : Visitor
*/
TemplateInstance ti = d.parent.isTemplateInstance();
assert(ti);
source_name(ti);
Dsymbol p = ti.toParent();
if (p && !p.isModule() && tf.linkage == LINK.cpp)
{
buf.writeByte('N');
CV_qualifiers(d.type);
prefix_name(p);
if (d.isDtorDeclaration())
buf.writestring("D1");
else
source_name(ti);
buf.writeByte('E');
}
else
source_name(ti);
headOfType(tf.nextOf()); // mangle return type
}
else
Expand Down
12 changes: 12 additions & 0 deletions test/compilable/cppmangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,15 @@ version (linux)
{
static assert(test36.mangleof == "_Z6test36PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPiPS12_");
}

/*****************************************/
// https://issues.dlang.org/show_bug.cgi?id=17772

extern(C++, SPACE)
int test37(T)(){ return 0;}

version (Posix) // all non-Windows machines
{
static assert(test37!int.mangleof == "_ZN5SPACE6test37IiEEiv");
}

0 comments on commit 9bed5b4

Please sign in to comment.