diff options
Diffstat (limited to 'gcc/d/dmd/statementsem.d')
-rw-r--r-- | gcc/d/dmd/statementsem.d | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/d/dmd/statementsem.d b/gcc/d/dmd/statementsem.d index bbaee8e..694db28 100644 --- a/gcc/d/dmd/statementsem.d +++ b/gcc/d/dmd/statementsem.d @@ -1941,7 +1941,6 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor } if (checkNonAssignmentArrayOp(ifs.condition)) ifs.condition = ErrorExp.get(); - ifs.condition = checkGC(scd, ifs.condition); // Convert to boolean after declaring prm so this works: // if (S prm = S()) {} @@ -1953,6 +1952,10 @@ package (dmd) extern (C++) final class StatementSemanticVisitor : Visitor // This feature allows a limited form of conditional compilation. ifs.condition = ifs.condition.optimize(WANTvalue); + // checkGC after optimizing the condition so that + // compile time constants are reduced. + ifs.condition = checkGC(scd, ifs.condition); + // Save 'root' of two branches (then and else) at the point where it forks CtorFlow ctorflow_root = scd.ctorflow.clone(); @@ -4525,8 +4528,7 @@ public auto makeTupleForeach(Scope* sc, bool isStatic, bool isDecl, ForeachState decls.append(Dsymbol.arraySyntaxCopy(dbody)); else { - if (fs._body) // https://issues.dlang.org/show_bug.cgi?id=17646 - stmts.push(fs._body.syntaxCopy()); + stmts.push(fs._body.syntaxCopy()); s = new CompoundStatement(loc, stmts); } |