[Issue 8957] New: Closure not recognized when passing type with post-blit as lazy parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 3 07:20:14 PDT 2012


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: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from David Nadlinger <code at 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-dAuw@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: -------


More information about the Digitalmars-d-bugs mailing list