diff options
author | Ian Lance Taylor <iant@golang.org> | 2023-06-26 09:57:21 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2023-06-26 09:57:21 -0700 |
commit | aa1e672b5d99102b03eb5fb9c51609c45f62bff7 (patch) | |
tree | 886212591b1c9d127eaaf234a4a2e22452ea384a /gcc/d/dmd/statementsem.d | |
parent | 97e31a0a2a2d2273687fcdb4e5416aab1a2186e1 (diff) | |
parent | 3a39a31b8ae9c6465434aefa657f7fcc86f905c0 (diff) | |
download | gcc-devel/gccgo.zip gcc-devel/gccgo.tar.gz gcc-devel/gccgo.tar.bz2 |
Merge from trunk revision 3a39a31b8ae9c6465434aefa657f7fcc86f905c0.devel/gccgo
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); } |