Skip to content

Commit

Permalink
Fix bypassing nothrow in debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
dkorpel committed Jan 16, 2025
1 parent b237d03 commit 981df6b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
5 changes: 0 additions & 5 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1363,11 +1363,6 @@ private Expression resolveUFCSProperties(Scope* sc, Expression e1, Expression e2
auto arguments = new Expressions(1);
(*arguments)[0] = eleft;
e = new CallExp(loc, e, arguments);

// https://issues.dlang.org/show_bug.cgi?id=24017
if (sc.flags & SCOPE.debug_)
e.isCallExp().inDebugStatement = true;

e = e.expressionSemantic(sc);
return e;
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/statementsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -3461,6 +3461,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
sc = sc.push();
sc.flags |= SCOPE.debug_;
ds.statement = ds.statement.statementSemantic(sc);
debugThrowWalker(ds.statement);
sc.pop();
}
result = ds.statement;
Expand Down Expand Up @@ -4736,7 +4737,6 @@ private Statements* flatten(Statement statement, Scope* sc)
if (dc)
{
s = new DebugStatement(cs.loc, cs.ifbody);
debugThrowWalker(cs.ifbody);
}
else
s = cs.ifbody;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,14 @@ void test6() nothrow
() {throw new Exception("");}();
}
}

void writeln() {}
void writeln(string) {}

void test7() nothrow
{
debug writeln("Hello"); // https://issues.dlang.org/show_bug.cgi?id=24017
debug "Hello".writeln;
debug writeln = "Hello"; // https://github.com/dlang/dmd/issues/20719
debug writeln;
}
11 changes: 0 additions & 11 deletions compiler/test/compilable/test24017.d

This file was deleted.

0 comments on commit 981df6b

Please sign in to comment.