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

           Summary: [CTFE] Incorrect behaviour with pointers as local
                    struct variable fields
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: verylonglogin....@gmail.com


--- Comment #0 from Denis <verylonglogin....@gmail.com> 2012-01-01 14:15:04 MSK 
---
---
struct S { int* p, p2; }

int f() {
    assert(S().p == null);   // passes
    assert(!S().p);          // passes
    assert(S().p == S().p2); // passes

    auto s = S();
    assert(!s.p); // passes, note: `s.p` also passes
    assert(s.p == null); // fails
    assert(s.p == s.p2); // fails
    return 0;
}

int g() {
    auto s = S();
    assert(s.p);  // passes but should fail
    return 0;
}

void t()() { enum e = g(); } // const for D1

static assert(f() == 0);
// static assert is in a function because of @@@BUG3448@@@ aka @@@BUG965@@@
void f3448() { static assert(!__traits(compiles, t!()())); } // is(typeof())
for D1
---

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

Reply via email to