[Issue 18129] New: Function parameter 'scope' does not mean without @safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 26 12:30:43 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=18129
Issue ID: 18129
Summary: Function parameter 'scope' does not mean without @safe
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: sobaya007 at gmail.com
The document says that function parameter
'scope' prevents pointer from escaping.
But dmd allows it without @safe.
My test case here.
```
import std.stdio;
int[] x;
void func(scope int[] a) {
x = a;
}
void main() {
func([0,1,2]);
writeln(x);
}
```
Above code was successfully compiled.
This behavior is not written in document.
I think any explanation about it should be written.
--
More information about the Digitalmars-d-bugs
mailing list