Basically, I want this to fail: auto notNull(T, Args...)(Args args) { return NotNull!T(new T(args)); }
struct NotNull(T) { private T _value; @property ref inout(T) value() inout { return this._value; } alias value this; //disable opAssign to null as well } class C {} void func(ref C t) { t = null; } auto a = notNull!C; func(a); // i want a compile error hereAny ideas that don't involve disabling copying or making the property non-ref?
Full example here: https://run.dlang.io/is/ubOwkd Thanks!