Introduced by https://github.com/dlang/dmd/pull/5075
Specifically, the `semantic3Errors` can be set when gagged, but remain set when later ungagged. In opover.d, a function looked up with `semantic3Errors` can cause another expression to be set to `new ErrorExp()`. This expression then causes a cascaded error in `StatementSemanticVisitor.visit(ExpStatement)` where the `return setError()` is executed. `setError()` asserts if the global error count is not set. If that assert is disabled, another one asserts in `e2ir.d` which is not expecting an `ErrorStatement`.
It's hard to come up with a non-Phobos test case for this due to the massive complexity of Phobos.
Comment #1 by dlang-bot — 2019-03-07T01:35:30Z
@WalterBright created dlang/dmd pull request #9425 "partially address Issue 19722 - botched implementation of semantic3Er…" fixing this issue:
- partially address Issue 19722 - botched implementation of semantic3Errors causes compiler assert fail
https://github.com/dlang/dmd/pull/9425