[Issue 20820] New: [ob][DIP1021]Borrowing by a scope variable is not equivalent to a scope argument
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon May 11 12:38:12 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20820
Issue ID: 20820
Summary: [ob][DIP1021]Borrowing by a scope variable is not
equivalent to a scope argument
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: lempiji at gmail.com
Would it be appropriate for the following two to behave differently?
I think both should be NG for the same reasons.
https://run.dlang.io/is/X7Xf8l
```
import std;
import core.stdc.stdlib;
void main() @live {
auto p = cast(byte*) malloc(10);
scope(exit) free(p);
scope ps = p[0 .. 10];
writeln(ps); // NG
//writelns(ps); // OK
}
void writelns(Args)(scope Args args...)
{
writeln(args);
}
```
--
More information about the Digitalmars-d-bugs
mailing list