[Issue 20860] OpDispatch does not work for structs with constructor and destructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 26 04:09:34 UTC 2020


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

--- Comment #4 from Basile-z <b2.temp at gmx.com> ---
Expression semanticX(DotIdExp exp, Scope* sc)

dmd/expressionsem.d:
---
Expression semanticX(DotIdExp exp, Scope* sc)
{
+    printf("checkpoint %d : %s\n", 0, exp.toChars());
    //printf("DotIdExp::semanticX(this = %p, '%s')\n", this, toChars());
    if (Expression ex = unaSemantic(exp, sc))
        return ex;
+    printf("checkpoint %d : %s\n", 1, exp.toChars());
...
}
---

gives, for the test case:

> checkpoint 0 : A(int(0)).test
> checkpoint 1 : ((A __slA

so unaSemantic corrupts the expression.
`__slA` is a special symbol created in
dmd.expression.StructLiteralExp.addDtorHook().

So that's this method that does a bad rewrite (or maybe even a kind of
corruption)

--


More information about the Digitalmars-d-bugs mailing list