www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18129] New: Function parameter 'scope' does not mean without

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 puremagic.com
          Reporter: sobaya007 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.

--
Dec 26 2017