[Issue 17664] New: Deprecate implicit casting between shared and unshared
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 19 02:04:45 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17664
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 at puremagic.com
Reporter: dfj1esp02 at 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.
--
More information about the Digitalmars-d-bugs
mailing list