module bitintsafe; import std.bigint; void main() @safe { BigInt i, j, k; i = j + k; } $ dmd -c bigintsafe.d bigintsafe.d(8): Error: safe function 'D main' cannot call system function 'std.bigint.BigInt.opBinary!("+", BigInt).opBinary' I started looking into this but the rabit hole is fairly deep. Filing a bug in hopes that someone will take up the charge on this one while I work on others. I don't consider this an enhancement request since @safe and phobos really need to be in the 'just works' state.
I had a PR open for this a while back. https://github.com/D-Programming-Language/phobos/pull/2357 It came down to the same argument you're having on the newsgroup right now.
It also suffered from being too big. It would have been nice to get the non-controversial parts of the change in. There was very little use of the @trusted sledge hammer.
https://github.com/D-Programming-Language/phobos/pull/2612 another try
(In reply to Robert Schadek from comment #3) > https://github.com/D-Programming-Language/phobos/pull/2612 > > another try That was merged, but the error remains.
A further step in this direction: https://github.com/dlang/phobos/pull/5354 It's still not complete; BigInt is a pretty deep rabbit warren that will need some time to completely sort out. One step at a time!
What should be done about the inline asm heavily used by the BigInt implementation? We could use the sledgehammer approach and slap @trusted on all the inline asm code, but I'm a bit hesitant to do that.
This is more an enhancement, than a bug. Isn't it?
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10092 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB