Re: cannot take address of scope local in safe function

2021-06-14 Thread ag0aep6g via Digitalmars-d-learn
On 13.06.21 19:49, vit wrote: Is possible create and use scope output range allocated on stack in @safe code? Example: ```d //-dip1000     struct OutputRange{     private bool valid = true;     private void* ptr;     int count = 0;     void put(Val)(auto ref scope Val

Re: cannot take address of scope local in safe function

2021-06-13 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 13 June 2021 at 17:49:50 UTC, vit wrote: Is possible create and use scope output range allocated on stack in @safe code? Example: ```d //-dip1000 struct OutputRange{ private bool valid = true; private void* ptr; int count = 0; void

Re: cannot take address of scope local in safe function

2021-06-13 Thread vit via Digitalmars-d-learn
On Sunday, 13 June 2021 at 17:18:46 UTC, ag0aep6g wrote: On Sunday, 13 June 2021 at 16:27:18 UTC, vit wrote: Why I can take address of Foo variable but not Bar? ```d //-dip1000 struct Foo{ private double d; } struct Bar{ private void* ptr; } void main()@safe{ ///this is OK:

Re: cannot take address of scope local in safe function

2021-06-13 Thread ag0aep6g via Digitalmars-d-learn
On Sunday, 13 June 2021 at 16:27:18 UTC, vit wrote: Why I can take address of Foo variable but not Bar? ```d //-dip1000 struct Foo{ private double d; } struct Bar{ private void* ptr; } void main()@safe{ ///this is OK: { scope Foo x; scope ptr = }

cannot take address of scope local in safe function

2021-06-13 Thread vit via Digitalmars-d-learn
Why I can take address of Foo variable but not Bar? ```d //-dip1000 struct Foo{ private double d; } struct Bar{ private void* ptr; } void main()@safe{ ///this is OK: { scope Foo x; scope ptr = } ///Error: cannot take address of `scope` local `x` in