www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17658] New: Shared postblits and dtors conflict with


          Issue ID: 17658
           Summary: Shared postblits and dtors conflict with non-shared
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: jack jackstouffer.com

Unlike the ctor, dtors and postblits cannot be overloaded with a shared version
that gets called on shared instantiations.

The main problem with this is that making any non-trivial struct work with
shared is now impossible, and the user has to make a new struct that's marked
with shared on the signature.

struct A
    this(string a) {}
    this(string a) shared {}

    ~this() {}
    ~this() shared {}

    this(this) {}
    this(this) shared {}

void main()
    shared f = A("");


/d422/f152.d(7): Error: destructor f152.A.~this conflicts with destructor
f152.A.~this at /d422/f152.d(6)
/d422/f152.d(10): Error: function f152.A.__postblit conflicts with function
f152.A.__postblit at /d422/f152.d(9)

Jul 17 2017