[Issue 18823] New: null is not shared as far as templates go
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Fri May  4 09:39:48 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=18823
          Issue ID: 18823
           Summary: null is not shared as far as templates go
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dmitry.olsh at gmail.com
Tested on DMD 2.079.
void main(){
    // failure: template testme.takePointer cannot deduce function from
argument types 
    //!()(typeof(null)), candidates are: ...
    takePointer(null); 
    takePointer2(null);
}
void takePointer(T)(shared(T)* ptr){}
void takePointer2(T)(shared T* ptr){}
// same problem in the "real" world
void inPhobos(){
    import core.atomic;
    shared Object abc;
    shared Object b = new Object;
    cas(&abc, b, null); // doesn't compile
    cas(&abc, b, cast(shared)null); // this compiles
    atomicStore(abc, null); // this compiles as well
}
--
    
    
More information about the Digitalmars-d-bugs
mailing list