[Issue 17567] make shared methods callable on unshared objects (and covariant)
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Wed Jun 28 07:06:15 PDT 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17567
Andrei Alexandrescu <andrei at erdani.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at erdani.com
--- Comment #1 from Andrei Alexandrescu <andrei at erdani.com> ---
This is not possible. Thanks Timon Gehr for explaining this to me. Consider:
shared int* p;
struct S
{
  int x;
  void func() shared { p = &x; }
}
void bug()
{
    auto p = new S;
    p.func;
    ++p.x;
}
At this point we have threads getting shared access to x, but the current
thread believes x is unshared.
--
    
    
More information about the Digitalmars-d-bugs
mailing list