On Monday, 21 November 2016 at 10:25:17 UTC, Satoshi wrote:
Hello,
how can calling method on local struct throw "null this"?
struct is initialized by .init and have default values.


struct Foo {
Bar bar;

    static struct Bar {
        float x, y, z;
    }

Bar getBar() {
return bar;
}

}


then
Foo foo = Foo.init;
auto b = foo.getBar(); // throw "null this"



I had
auto ref getBar() inout {
    return bar;
}

in which was problem. When I separated it into 2 funcs get/set it works fine.
  • null this Satoshi via Digitalmars-d-learn
    • Re: null this Satoshi via Digitalmars-d-learn
    • Re: null this rikki cattermole via Digitalmars-d-learn
    • Re: null this Satoshi via Digitalmars-d-learn

Reply via email to