[Issue 2479] Badcode regression: closure corrupts _argptr value

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 15 05:21:37 PDT 2009


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Phobos                      |DMD
            Summary|sformat is broken           |Badcode regression: closure
                   |                            |corrupts _argptr value


--- Comment #5 from Don <clugdbug at yahoo.com.au> 2009-10-15 05:21:36 PDT ---
Reduced test case. This does not seem to be a Phobos bug.
If you remove any reference to s from the delegate (so that it stops being a 
closure), the code works correctly.
----
void doFormat(void delegate() myputc, void * argptr){
    assert(!(*cast(string*)argptr is null));
}

void sformat(string s, ...){
    void putc() { assert(s[0]==s[0]); }
    doFormat(&putc, _argptr);
}

void main(){
    sformat("xxx", "hi");
}

-- 
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