Issue 4220 - I cannot apply @safe to intrinsic operation(eg: std.math.sqrt)
Summary: I cannot apply @safe to intrinsic operation(eg: std.math.sqrt)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-22 19:27 UTC by SHOO
Modified: 2014-02-15 02:42 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SHOO 2010-05-22 19:27:36 UTC
I try to apply @safe/@trusted/@system to Phobos
See also http://lists.puremagic.com/pipermail/phobos/2010-May/000488.html
I found this issue there.

This issue causes mangling that had been influenced by @safe/@trusted.
dmd converts a specific symbol into intrinsic operation. However, dmd cannot convert symbols that are marked by @safe/@trusted.
I am skeptical about the influence on mangling rule by @safe.
It may be related to overload, but I think that overload is unnecessary.
Comment 1 Walter Bright 2010-05-23 21:23:26 UTC
changeset 499
(also requires new std.math)
Comment 2 Walter Bright 2010-05-23 21:26:31 UTC
Requires the following changes to std.math:

317c317
< pure nothrow real cos(real x);       /* intrinsic */
---
> @safe pure nothrow real cos(real x);       /* intrinsic */
332c332
< pure nothrow real sin(real x);       /* intrinsic */
---
> @safe pure nothrow real sin(real x);       /* intrinsic */
397c397
< pure nothrow real tan(real x)
---
> @trusted pure nothrow real tan(real x)
808c808
< pure nothrow long rndtol(real x);    /* intrinsic */
---
> @safe pure nothrow long rndtol(real x);    /* intrinsic */
830c830
< pure nothrow
---
> @safe pure nothrow
1388c1388
< pure nothrow real ldexp(real n, int exp);    /* intrinsic */
---
> @safe pure nothrow real ldexp(real n, int exp);    /* intrinsic */
1582c1582
< pure nothrow real fabs(real x);      /* intrinsic */
---
> @safe pure nothrow real fabs(real x);      /* intrinsic */
1781c1781
< pure nothrow real rint(real x);      /* intrinsic */
---
> @safe pure nothrow real rint(real x);      /* intrinsic */
3610,3611c3610,3611
< pure nothrow real yl2x(real x, real y);         // y * log2(x)
< pure nothrow real yl2xp1(real x, real y);       // y * log2(x + 1)
---
> @safe pure nothrow real yl2x(real x, real y);         // y * log2(x)
> @safe pure nothrow real yl2xp1(real x, real y);       // y * log2(x + 1)