www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13174] New: shared ~this() conflicts with this()


          Issue ID: 13174
           Summary: shared ~this() conflicts with this()
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: vlevenfeld gmail.com

I am unable to define a destructor in a struct which may or may not be shared.
Possible duplicate of issue #12004, because if Macro's suggestion were
followed, it would solve the problem for my use case.

struct Foo
    ~this () {}
struct Bar
    shared ~this () {}
struct Baz
    ~this () {}
    shared ~this () {} // source/main.d(44): Error: destructor main.Baz.~this
conflicts with destructor main.Baz.~this at source/main.d(43)
void main ()
    Foo foo;
    shared Bar bar;

    shared Foo s_foo; // source/main.d(51): Error: non-shared method
main.Foo.~this is not callable using a shared object
    Bar n_bar; // source/main.d(52): Error: shared method main.Bar.~this is not
callable using a non-shared object

Jul 20 2014