Skip to content

Commit

Permalink
correct namespace mangling for Issue 17772
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Feb 23, 2018
1 parent 0e56626 commit 5bb9d29
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 5bb9d29

Please sign in to comment.