[Issue 18529] .ptr on arrays can no longer be used in @safe code prevents valid code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 27 10:25:03 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18529

--- Comment #7 from Timothee Cour <timothee.cour2 at gmail.com> ---
>> Anecdotically, all of core.demangle is broken.

> Are you sure? It has safe unittests, they wouldn't compile if it was broken.

try with -debug=info

these will error:
debug(info) printf( "overflow: %.*s\n", cast(int) msg.length, msg.ptr );
(many others in this file)

Why would this be suddently invalid? what's a workaround?

NOTE: this should work regardless of debug(info) being present; so: even if 
https://issues.dlang.org/show_bug.cgi?id=18407 were fixed, what would be a
workaround for:

printf( "overflow: %.*s\n", cast(int) msg.length, msg.ptr );

(not involving something like:
```
if(msg.length)
printf( "overflow: %.*s\n", cast(int) msg.length, msg.ptr );
else
printf( "overflow: \n");
```
)

--


More information about the Digitalmars-d-bugs mailing list