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


Don <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |[email protected]


--- Comment #2 from Don <[email protected]> 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