Andrei's list of barriers to D adoption

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 7 11:54:25 PDT 2016


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



More information about the Digitalmars-d mailing list