Thread overview
[Issue 12581] [ICE](statement.c, line 713) with invalid assignment + alias this
Apr 15, 2014
Kenji Hara
April 15, 2014
https://issues.dlang.org/show_bug.cgi?id=12581

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice, pull

--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> ---
https://github.com/D-Programming-Language/dmd/pull/3454

--
April 15, 2014
https://issues.dlang.org/show_bug.cgi?id=12581

--- Comment #2 from github-bugzilla@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.

--
April 15, 2014
https://issues.dlang.org/show_bug.cgi?id=12581

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--