digitalmars.D.bugs - [Issue 20989] New: Checking array.ptr causes safety error with
- d-bugmail puremagic.com (29/29) Jun 28 2020 https://issues.dlang.org/show_bug.cgi?id=20989
https://issues.dlang.org/show_bug.cgi?id=20989 Issue ID: 20989 Summary: Checking array.ptr causes safety error with -checkaction=context Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: minor Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: moonlightsentinel disroot.org The following code fails to compile with -checkaction=context: ======================================== void main() safe { uint[] arr = [1, 2, 3]; assert(!arr.ptr); assert(arr.ptr is arr.ptr); } ======================================== dmd --checkaction=context safety.d safety.d(6): Error: arr.ptr cannot be used in safe code, use &arr[0] instead safety.d(7): Error: arr.ptr cannot be used in safe code, use &arr[0] instead safety.d(7): Error: arr.ptr cannot be used in safe code, use &arr[0] instead ======================================== --
Jun 28 2020