www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17664] New: Deprecate implicit casting between shared and


          Issue ID: 17664
           Summary: Deprecate implicit casting between shared and unshared
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: spec
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dfj1esp02 sneakemail.com

struct A { int handle; }
shared A b;
void f(A a){ b=a; }
This shouldn't compile. Value types include resource identifiers, which may
have threading requirements, e.g. GUI widget handles and OpenGL handles,
assuming they are thread-safe and making them implicitly shared is incorrect.

union A { int handle; int* dummy; }
This can't work as a workaround because it has different size than the handle.

Jul 19 2017