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

           Summary: Closure not recognized when passing type with
                    post-blit as lazy parameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: c...@klickverbot.at


--- Comment #0 from David Nadlinger <c...@klickverbot.at> 2012-11-03 07:20:13 
PDT ---
This is a follow-up to the thread �Expression::apply, DeclarationExp and a
possible nested context bug� on dmd-internals:
http://forum.dlang.org/thread/cap9j_hxg8mttnoju9ywyusgzp1nqcdy0+7oehyoq2whnr-d...@mail.gmail.com

The following test case shows that the problem I brought up there there also
leads to wrong-code bugs in DMD (at least I hope it's still the original
problem, I simply extended this from the minimal testcase linked in the
thread):

---
extern(C) void printf(const char*, ...);

struct HasPostblit {
    this(this) {};
}

struct Foo {
    HasPostblit hp;
    int i;
}

void print(Foo f) {
    printf("%x\n", f.i);
}

auto toDg(E)(lazy E e) {
    return { return e(); };
}

auto getDg() {
    Foo a;
    a.i = 0x1;
    return toDg(print(a));
}

void smashStack() {
    int[1024] dummy = 0xcafebabe;
}

void main() {
    auto d = getDg();
    smashStack();
    d();
}
---

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

Reply via email to