Question about scope
Nemanja Boric via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 27 06:36:20 PST 2017
Taken from
https://github.com/dlang/druntime/pull/1750#discussion_r98181564:
```
void bar(scope char** c, scope int* n) @trusted
{
}
void foo() @safe
{
char[100] buf;
char* c = &buf[0];
int n;
bar(&c, &n);
}
void main()
{
foo();
}
```
This doesn't compile even with dip1000, but does compile when
`buf` is moved out of the scope. Can somebody explain why it
fails and what needs to be done with it?
More information about the Digitalmars-d
mailing list