[Issue 20193] New: Using shared in the class declaration does not make the class implicitly shared like for a struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 4 20:16:36 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20193

          Issue ID: 20193
           Summary: Using shared in the class declaration does not make
                    the class implicitly shared like for a struct
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: ali.akhtarzada at gmail.com

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.

--


More information about the Digitalmars-d-bugs mailing list