Prototype of Ownership/Borrowing System for D
Walter Bright
newshound2 at digitalmars.com
Tue Dec 3 08:20:57 UTC 2019
On 11/23/2019 8:05 PM, mipri wrote:
> And this crashes dmd:
> ---
> import core.stdc.stdlib: malloc, free;
>
> @live void zoo() {
> int* p = cast(int*)malloc( int.sizeof * 2 );
> foo(p, p + 1);
> }
>
> @live void foo( scope int* p, scope int* q ) {
> *q = 10; // use after free.
> }
> ---
> core.exception.RangeError at dmd/ob.d(1526): Range violation
Good. I'll take care of that.
More information about the Digitalmars-d
mailing list