Skip to content

Commit

Permalink
Merge pull request #5330 from WalterBright/fix15389
Browse files Browse the repository at this point in the history
fix Issue 15389 - extern(C++) forward referencing problem
  • Loading branch information
yebblies authored and MartinNowak committed Jan 6, 2016
1 parent e50f8aa commit 8399e29
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/nspace.d
Expand Up @@ -159,6 +159,21 @@ public:
return Dsymbol.oneMember(ps, ident);
}

override final Dsymbol search(Loc loc, Identifier ident, int flags = IgnoreNone)
{
//printf("%s.Nspace.search('%s')\n", toChars(), ident.toChars());
if (_scope && !symtab)
semantic(_scope);

if (!members || !symtab) // opaque or semantic() is not yet called
{
error("is forward referenced when looking for '%s'", ident.toChars());
return null;
}

return ScopeDsymbol.search(loc, ident, flags);
}

override int apply(Dsymbol_apply_ft_t fp, void* param)
{
if (members)
Expand Down
7 changes: 7 additions & 0 deletions test/compilable/test15389_x.d
@@ -0,0 +1,7 @@
import test15389_y;

//struct ns
extern (C++, ns)
{
class X { test15389_y.ns.Y a; }
}
8 changes: 8 additions & 0 deletions test/compilable/test15389_y.d
@@ -0,0 +1,8 @@
import test15389_x;

//struct ns
extern (C++, ns)
{
class Y { test15389_x.ns.X b; }
}

0 comments on commit 8399e29

Please sign in to comment.