June 28, 2018 [Issue 19035] New: Escape in scope inference, improve scope inference | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19035 Issue ID: 19035 Summary: Escape in scope inference, improve scope inference Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: bugzilla@digitalmars.com Consider: ---------- @safe: void escape(int*); /**********************/ void frank()(ref scope int* p, int* s) { p = s; // should error here, does not } void testfrankly() { int* p; int i; frank(p, &i); // note that p now has a reference to i, and can outlast i } /**********************/ void betty()(int* p, int* q) { p = q; escape(p); } void testbetty() { int i; int j; betty(&i, &j); // should error on i and j, and it does } /**********************/ void archie()(int* p, int* q, int* r) { p = q; r = p; escape(q); } @safe void testarchie() { int i; int j; int k; archie(&i, &j, &k); // should error only on j, not i and j } ------- -- |
Copyright © 1999-2021 by the D Language Foundation