www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20820] New: [ob][DIP1021]Borrowing by a scope variable is not


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

Would it be appropriate for the following two to behave differently?
I think both should be NG for the same reasons.


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...)

May 11 2020