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


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugd...@yahoo.com.au


--- Comment #2 from Don <clugd...@yahoo.com.au> 2010-10-19 08:42:34 PDT ---
REDUCED TEST CASE:
void doNothing() {}

void bug5071(short d, ref short c) {
   assert(c==0x76);

    void closure() {
        auto c2 = c;
        auto d2 = d;
        doNothing();
    }
    auto useless = &closure;    
}

void main()
{
   short c = 0x76;
   bug5071(7, c);
}

PATCH: toir.c, FuncDeclaration::buildClosure(), line 648.
When it copies the parameters into the closure, it correctly recognizes that
ref params are just pointers. But, it needs to do the same thing when working
out what offsets they are at.

#if DMDV2
            if (v->storage_class & STClazy)
            {
                /* Lazy variables are really delegates,
                 * so give same answers that TypeDelegate would
                 */
                memsize = PTRSIZE * 2;
                memalignsize = memsize;
                xalign = global.structalign;
            }
+            else if (v->isRef() || v->isOut())
+            {    // reference parameters are just pointers
+                memsize = PTRSIZE;
+                memalignsize = memsize;
+                xalign = global.structalign;
+            }
            else
#endif
            {
                memsize = v->type->size();
                memalignsize = v->type->alignsize();
                xalign = v->type->memalign(global.structalign);
            }

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

Reply via email to