[Issue 12581] [ICE](statement.c, line 713) with invalid assignment + alias this

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 15 11:17:39 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12581

--- Comment #2 from github-bugzilla at puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/de1a6e570e2b7a135d40ce0bebc312be90e2101a
fix Issue 12581 - [ICE](statement.c, line 713) with invalid assignment + alias
this

Make AssignExp::semantic reentrant for `op_overload` call.

-----

If an expression supports operator overloading, its `semantic` function should
not store error expressions in itself until the point of `op_olverload` call
(from [a] to [b]).

Example:

Expression *XXXExp::semantic(Scope sc)
{
  // [a]
    ...
    e1 = e1->semantic(sc);  // Bad: if semantic analysis returns ErrorExp,
                            // it is stored in this->e1 immediately.
    if (e1->op == TOKerror)
        return e1;

  // [b]
    Expression *e = op_overload(sc);
    if (e)
        return e;
    ...
}

If `XXXExp::semantic` is called from the `trySemantic` call for `alias this`
analysis (from `op_overload` function in `opover.c`), the stored ErrorExp would
accidentally escape from the gagged period.

--


More information about the Digitalmars-d-bugs mailing list