www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18474] New: Postblit not working in shared structs


          Issue ID: 18474
           Summary: Postblit not working in shared structs
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: edi33416 gmail.com

The postblit for shared struct is not working as expected, as it is not
infering the `shared` attribute.

For the snippet bellow

shared struct A

struct B
    A a;

void main()
    shared B b1;
    auto b2 = b1;

the compiler gives the following error:

Error: non-shared method test.B.__fieldPostblit is not callable using a shared

The current workaround for this is to define `A` s postblit as
this(shared this);

Feb 20 2018