www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20193] New: Using shared in the class declaration does not

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 puremagic.com
          Reporter: ali.akhtarzada 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.

--
Sep 04 2019