Skip to content

Commit

Permalink
fix Issue 10354 - DIP37: ICE with using indirectly imported template …
Browse files Browse the repository at this point in the history
…through package.d
  • Loading branch information
9rnsr committed Jun 14, 2013
1 parent 095b58a commit eea99d6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/import.c
Expand Up @@ -166,10 +166,10 @@ void Import::load(Scope *sc)
{
dst->insert(id, mod); // id may be different from mod->ident,
// if so then insert alias
if (!mod->importedFrom)
mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule;
}
}
if (mod && !mod->importedFrom)
mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule;
if (!pkg)
pkg = mod;

Expand Down
2 changes: 2 additions & 0 deletions test/compilable/extra-files/pkgDIP37_10354/mbar.d
@@ -0,0 +1,2 @@
module pkgDIP37_10354.mbar;
void bar(T)() {}
2 changes: 2 additions & 0 deletions test/compilable/extra-files/pkgDIP37_10354/mfoo.d
@@ -0,0 +1,2 @@
module pkgDIP37_10354.mfoo;
void foo(T)() {}
3 changes: 3 additions & 0 deletions test/compilable/extra-files/pkgDIP37_10354/package.d
@@ -0,0 +1,3 @@
module pkgDIP37_10354;
public import pkgDIP37_10354.mfoo;
public import pkgDIP37_10354.mbar;
11 changes: 11 additions & 0 deletions test/compilable/testDIP37_10354.d
@@ -0,0 +1,11 @@
// PERMUTE_ARGS:
// REQUIRED_ARGS: -o- -Icompilable/extra-files

module testDIP37_10354;
import pkgDIP37_10354.mfoo;
void main()
{
import pkgDIP37_10354;
foo!string(); // OK
bar!string(); // OK <- ICE
}

0 comments on commit eea99d6

Please sign in to comment.