[Issue 7295] New: Alias This + Pure + pointsTo = rejects-valid
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Jan 15 08:26:36 PST 2012
    
    
  
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: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com
--- Comment #0 from David Simcha <dsimcha at 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: -------
    
    
More information about the Digitalmars-d-bugs
mailing list