Skip to content

Commit

Permalink
Merge pull request #4333 from gchatelet/master
Browse files Browse the repository at this point in the history
fix Issue 13337 - Invalid extern C++ namespace resolution
  • Loading branch information
WalterBright committed Jan 24, 2015
2 parents 2a0eca6 + a38205b commit 15e52b1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cppmangle.c
Expand Up @@ -249,7 +249,6 @@ class CppMangleVisitor : public Visitor
//printf("prefix_name(%s)\n", s->toChars());
if (!substitute(s))
{
store(s);
Dsymbol *p = s->toParent();
if (p && p->isTemplateInstance())
{
Expand All @@ -268,6 +267,7 @@ class CppMangleVisitor : public Visitor
{
prefix_name(p);
}
store(s);
source_name(s);
}
}
Expand Down
11 changes: 11 additions & 0 deletions test/compilable/cppmangle.d
Expand Up @@ -287,3 +287,14 @@ static assert(CallExp.test11696b.mangleof == "_ZN7CallExp10test11696bE3LocP10Exp
static assert(CallExp.test11696c.mangleof == "_ZN7CallExp10test11696cE3LocPP10ExpressionS2_");
static assert(CallExp.test11696d.mangleof == "_ZN7CallExp10test11696dE3LocPP10ExpressionS3_");

/**************************************/
// 13337

extern(C++, N13337a.N13337b.N13337c)
{
struct S13337{}
void foo13337(S13337 s);
}

static assert(foo13337.mangleof == "_ZN7N13337a7N13337b7N13337c8foo13337ENS1_6S13337E");

9 changes: 9 additions & 0 deletions test/runnable/cppa.d
Expand Up @@ -709,6 +709,14 @@ extern(C++) void func13932(S13932!(-1) s);

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

extern(C++, N13337.M13337)
{
struct S13337{}
void foo13337(S13337 s);
}

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

void main()
{
test1();
Expand All @@ -735,6 +743,7 @@ void main()
test16();
func13707();
func13932(S13932!(-1)(0));
foo13337(S13337());

printf("Success\n");
}
9 changes: 9 additions & 0 deletions test/runnable/extra-files/cppb.cpp
Expand Up @@ -446,3 +446,12 @@ template <int x> struct S13932
void func13932(S13932<-1> s) {}

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

namespace N13337 {
namespace M13337 {
struct S13337 { };
void foo13337(S13337 s) { }
}
}

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

0 comments on commit 15e52b1

Please sign in to comment.