On 6/7/16 2:43 PM, jmh530 wrote:
On Tuesday, 7 June 2016 at 18:32:05 UTC, Adam D. Ruppe wrote:
On Tuesday, 7 June 2016 at 18:24:33 UTC, Walter Bright wrote:
You can also add:

   @nogc:

at the top, too. It isn't necessary to tediously annotate every
function.

@nogc:

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

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();
}

That's because main is @nogc. If you did:

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

@nogc:

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

it would work. Adam's point is that putting @nogc: at the top doesn't mark everything @nogc.

-Steve

Reply via email to