digitalmars.D.bugs - [Issue 18216] New: struct no size because of forward reference
- d-bugmail puremagic.com (50/50) Jan 08 2018 https://issues.dlang.org/show_bug.cgi?id=18216
https://issues.dlang.org/show_bug.cgi?id=18216 Issue ID: 18216 Summary: struct no size because of forward reference Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: blocker Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: changlon gmail.com ================== struct Node { mixin Type!() ; Pointer left; } mixin template Type() { alias Base = typeof(this) ; static struct Proxy { struct Node { Base m_payload ; } static immutable default_value = Base.init ; // just remove this will work } alias pNode = shared(Proxy.Node)* ; static struct Pointer { Base* _ptr ; auto ptr() { return cast(pNode) _ptr ; } void opAssign(ref Pointer other) {} // just remove this will work alias getThis this; // just remove this will work ref auto getThis() return { return ptr.m_payload; } } } =============================== Error: struct test.Node no size because of forward reference test.d(28): Error: function type 'pure nothrow nogc return safe _error_()' has 'return' but does not return any indirections test.d(3): Error: mixin test.Node.Type!() error instantiating If I remove "void opAssign(ref Pointer other)", or "static immutable default_value = Base.init", or "alias getThis this" (just remove any one of the three), the code will working. --
Jan 08 2018