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

           Summary: Alias This + Pure + pointsTo = rejects-valid
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha <dsim...@yahoo.com> 2012-01-15 08:26:34 PST ---
import std.exception;

struct RefCounted(T) {
    T payload;

    T refCountedPayload() { return payload;}
    alias refCountedPayload this;
}

void main() {
    RefCounted!int x;
    doPure(x);
}

void doPure(ref RefCounted!int lhs) pure {
    std.exception.pointsTo(lhs, lhs);
}

test.d(16): Error: pure function 'doPure' cannot call impure function
'refCountedPayload'

Marking as critical because this breaks std.algorithm.swap for ref counted
types, though there may be an easy workaround:  refCountedPayload() should
probably be pure.

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

Reply via email to