Bug 20193 – Using shared in the class declaration does not make the class implicitly shared like for a struct
Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2019-09-04T20:16:36Z
Last change time
2022-05-25T14:16:10Z
Assigned to
No Owner
Creator
Ali Ak
Comments
Comment #0 by ali.akhtarzada — 2019-09-04T20:16:36Z
shared struct S {}
shared class C {}
void main() {
auto s = S();
auto c = new C();
pragma(msg, typeof(s)); // shared(S)
pragma(msg, typeof(c)); // C
}
I'd expect a this to be consistent so that a class defined as shared can only be created as shared - like a struct.
Comment #1 by schveiguy — 2022-05-25T14:16:10Z
*** This issue has been marked as a duplicate of issue 22515 ***