[Issue 5117] [CTFE] Member function call with rather complex this: side effects ignored

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 8 08:32:59 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5117



--- Comment #4 from Don <clugdbug at yahoo.com.au> 2010-11-08 08:31:56 PST ---
(In reply to comment #3)
> I applied the patch, and the first test case now works but the second still
> fails:
> 
> test.d(7): Error: assert(s.value == 1) failed
> test.d(1): Error: cannot evaluate test() at compile time
> test.d(1): Error: cannot evaluate test() at compile time
> 
> Perhaps your sources differ in other ways?
> 
> http://www.dsource.org/projects/dmd/changeset/742

Not sure what's happened here. Maybe I got the test case wrong. Regardless,
this change (line 228) fixes it.


    // Don't restore the value of 'this' upon function return
    if (needThis() && istate)
    {
        VarDeclaration *thisvar = findParentVar(thisarg, istate->localThis);
+        if (!thisvar) // it's a reference. Find which variable it refers to.
+            thisvar = findParentVar(thisarg->interpret(istate),
istate->localThis);
        for (size_t i = 0; i < istate->vars.dim; i++)
        {   VarDeclaration *v = (VarDeclaration *)istate->vars.data[i];

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list