why is the 'return' attribute not working?

mesni mensikovk817 at gmail.com
Sun May 1 21:09:14 UTC 2022


It doesn't throw any error
```d
import std.stdio;

void main()
{
     int id = IdWrap().getID;
     writeln("use: ", id);
}

struct IdWrap
{
     private int _id;

     int getID() return
     {
     	return _id;
     }

     ~this(){
     	writeln("delete id:(");
     }
}
```

Moreover, if you return `this.someSlice.ptr` in the return method 
in a structure, there will also be no error.


More information about the Digitalmars-d mailing list