Skip to content

Commit

Permalink
Merge pull request #6014 from MartinNowak/fix16348
Browse files Browse the repository at this point in the history
fix Issue 16348 - ICE with package visibility
  • Loading branch information
WalterBright authored Aug 8, 2016
2 parents 5a16fbb + 93c3dcf commit d400dff
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/statement.d
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ public:
// Same as semanticNoScope(), but do create a new scope
final Statement semanticScope(Scope* sc, Statement sbreak, Statement scontinue)
{
Scope* scd = sc.push();
auto sym = new ScopeDsymbol();
sym.parent = sc.scopesym;
Scope* scd = sc.push(sym);
if (sbreak)
scd.sbreak = sbreak;
if (scontinue)
Expand Down
6 changes: 6 additions & 0 deletions test/compilable/imports/test16348.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module mypackage.bar;

package bool bar()
{
return false;
}
13 changes: 13 additions & 0 deletions test/compilable/test16348.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// EXTRA_SOURCES: imports/test16348.d
module mypackage.foo;

void bug()
{
// removing the if-else also removes the segfault
if (true) {}
else
{
import mypackage.bar;
auto b = bar();
}
}

0 comments on commit d400dff

Please sign in to comment.