On 07.06.2016 20:43, jmh530 wrote:


Are you trying to say that you shouldn't be allowed to do that? I get an
error when I actually call x.a().

@nogc:

struct Foo {
         int* a() { return new int; }
}

void main()
{
     Foo x;
     auto y = x.a();
}

You'll get the same error for this program:

@nogc:

struct Foo {
    int x;
    int* a() { return &x; }
}

void main(){
    Foo x;
    auto y = x.a();
}

Reply via email to