May 14, 2019 [Issue 19873] New: unittest should be by default @system even with -preview=dip1000 | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19873 Issue ID: 19873 Summary: unittest should be by default @system even with -preview=dip1000 Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: greeenify@gmail.com --- @system unittest { int i; int* p = &i; int[] slice = [0, 1, 2, 3, 4]; int[5] arr = [0, 1, 2, 3, 4]; int*[] slicep = [p]; } --- Compiles fine with -unittest -preview=dip1000. Remove @system: --- unittest { int i; int* p = &i; int[] slice = [0, 1, 2, 3, 4]; int[5] arr = [0, 1, 2, 3, 4]; int*[] slicep = [p]; } --- $ dmd -unittest -preview=dip1000 foo.d And now it errors: --- foo.d(7): Error: scope variable p may not be copied into allocated memory --- -- |
Copyright © 1999-2021 by the D Language Foundation