==================
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.
Comment #1 by stanislav.blinov — 2021-12-08T22:27:32Z
This compiles with 2.098. Not closing yet as this likely needs regression tests. Who able?
Comment #2 by dlang-bot — 2022-04-19T05:49:09Z
@RazvanN7 created dlang/dmd pull request #14012 "Add test for Issue 18216" mentioning this issue:
- Add test for Issue 18216
https://github.com/dlang/dmd/pull/14012
Comment #3 by razvan.nitu1305 — 2022-04-19T05:49:43Z
Test is linked in description. Closing this.
Comment #4 by dlang-bot — 2022-04-19T07:25:40Z
dlang/dmd pull request #14012 "Add test for Issue 18216" was merged into master:
- 8ae79d141803a13973d3a476aae37601d954b2a7 by RazvanN7:
Add test for Issue 18216
https://github.com/dlang/dmd/pull/14012