Skip to content

Commit

Permalink
fix Issue 17660 - ICE with : AssertError@ddmd/visitor.d(39)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgehr committed Jul 17, 2017
1 parent dd6285d commit 425f129
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 30 deletions.
12 changes: 0 additions & 12 deletions src/ddmd/dinterpret.d
Expand Up @@ -415,12 +415,6 @@ public:
ctfeCompile(s.statement);
}

override void visit(ForwardingStatement s)
{
assert(!!s.statement);
s.statement.accept(this);
}

override void visit(OnScopeStatement s)
{
debug (LOGCOMPILE)
Expand Down Expand Up @@ -1244,12 +1238,6 @@ public:
result = interpret(s.statement, istate);
}

override void visit(ForwardingStatement s)
{
assert(!!s.statement);
s.statement.accept(this);
}

/**
Given an expression e which is about to be returned from the current
function, generate an error if it contains pointers to local variables.
Expand Down
8 changes: 0 additions & 8 deletions src/ddmd/hdrgen.d
Expand Up @@ -189,14 +189,6 @@ public:
buf.writenl();
}

override void visit(ForwardingStatement s)
{
if (s.statement)
{
s.statement.accept(this);
}
}

override void visit(WhileStatement s)
{
buf.writestring("while (");
Expand Down
9 changes: 0 additions & 9 deletions src/ddmd/s2ir.d
Expand Up @@ -980,15 +980,6 @@ extern (C++) class S2irVisitor : Visitor
}
}

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

override void visit(ForwardingStatement s)
{
assert(!!s.statement);
s.statement.accept(this);
}

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

Expand Down
5 changes: 4 additions & 1 deletion src/ddmd/visitor.d
Expand Up @@ -86,7 +86,10 @@ extern (C++) class Visitor

void visit(ForwardingStatement s)
{
visit(cast(Statement)s);
if (s.statement)
{
s.statement.accept(this);
}
}

void visit(WhileStatement s)
Expand Down
6 changes: 6 additions & 0 deletions test/compilable/staticforeach.d
Expand Up @@ -632,3 +632,9 @@ void testEmpty(){
static foreach(i;0..0) { }
}

auto bug17660(){
int x;
static foreach (i; 0 .. 1) { return 3; }
return x;
}
static assert(bug17660()==3);

0 comments on commit 425f129

Please sign in to comment.