www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19722] New: botched implementation of semantic3Errors causes


          Issue ID: 19722
           Summary: botched implementation of semantic3Errors causes
                    compiler assert fail
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

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.

Mar 06 2019