Skip to content

Commit

Permalink
Merge pull request #3264 from 9rnsr/fix12158
Browse files Browse the repository at this point in the history
[REG2.056] Issue 12158 - ICE with .init of nonexisting selective import
  • Loading branch information
AndrejMitrovic authored and 9rnsr committed Feb 15, 2014
1 parent b1ba734 commit 3e79f51
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ void Import::semantic(Scope *sc)
sc->protection = PROTpublic;
#endif
for (size_t i = 0; i < aliasdecls.dim; i++)
{ AliasDeclaration *ad = aliasdecls[i];

//printf("\tImport alias semantic('%s')\n", s->toChars());
{
AliasDeclaration *ad = aliasdecls[i];
//printf("\tImport alias semantic('%s')\n", ad->toChars());
if (mod->search(loc, names[i]))
{
ad->semantic(sc);
Expand All @@ -265,6 +265,7 @@ void Import::semantic(Scope *sc)
mod->error(loc, "import '%s' not found, did you mean '%s %s'?", names[i]->toChars(), s->kind(), s->toChars());
else
mod->error(loc, "import '%s' not found", names[i]->toChars());
ad->type = Type::terror;
}
}
sc = sc->pop();
Expand Down
8 changes: 8 additions & 0 deletions test/fail_compilation/ice12158.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice12158.d(7): Error: module object import 'nonexisting' not found
---
*/
import object : nonexisting;
auto x = nonexisting.init;

0 comments on commit 3e79f51

Please sign in to comment.