[Issue 8955] Can't have qualified field with not-qualified constructor/postblit

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 3 07:25:18 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8955



--- Comment #1 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-11-03 17:25:18 MSK ---
Partial workaround:

For const/immutable postblit/dtor:
---
struct S
{
    private void myPostblit() { }
    this(this) inout
    { (cast(S*) &this).myPostblit(); }

    private void myDtor() { }
    ~this() inout // Plese `inout` before `~this()` if Issue 8953 unfixed
    { (cast(S*) &this).myDtor(); }
}

struct S_ { const S sc; immutable S si; }
---
Note: at least `this(this) inout { }` or `opAssign` is required for dtor

For shared dtor:
---
struct S
{
    void opAssign(shared S s) shared { this = s; } // required for dtor

    private void myDtor() { }
    shared~this()  // Plese `inout` before `~this()` if Issue 8953 unfixed
    { (cast(S*) &this).myDtor(); }
}

struct S_ { shared S sc; }
---

Same for constructor except it doesn't require somebody like dtor.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list