fix Issue 5305 - intrinsic functions have @safe stripped of them in r…#5845
fix Issue 5305 - intrinsic functions have @safe stripped of them in r…#5845andralex merged 1 commit intodlang:masterfrom
Conversation
|
|
Auto-merge toggled on |
|
I seem to recall @yebblies was adamant that Phobos shouldn't be imported in DMD tests |
|
Yes. |
|
Auto-merge toggled off |
|
This is a compiler test, not a library test, and as such a test for it properly belongs in the compiler suite. |
| @@ -0,0 +1,7 @@ | |||
| // https://issues.dlang.org/show_bug.cgi?id=5305 | |||
There was a problem hiding this comment.
Shouldn't // REQUIRE_ARGS: -release be used here ?
|
Given |
|
The intrinsic is directly associated, by the compiler, to std.math. Not something else. That's what needs to be tested. @yebblies is generally right, because when porting dmd to a new platform it is very convenient to get it to pass the compiler tests before attempting to compile/debug Phobos. This is why this particular test is in its own file - it can be easily skipped when porting. This case is an exception. |
|
The issue title is confusing. I read it again and I'm going to close the issue as duplicate of 4541. For reference: import core.math;
void map(real function(real) f) { }
void main() { map(&sqrt); }So I suggest to close this P.R. as well. |
|
The test case is to verify that taking the address of sqrt in std.math works. This test case is valid, and should be pulled to resolve the issue. 4541 is something else. |
|
@WalterBright : The intrinsics are defined in core.math. In DMD we have a duplicate definition, one for core.math and one for std.math. The duplication was introduced in #20 to allow for this very change, but was obviously forgotten for a couple of years. Thanks to the Phobos P.R. I mentioned earlier, a symbol with the same mangling as the |
|
Yah, it's reasonable to import |
|
Auto-merge toggled on |
Did you read the previous comments ? |
|
What the hell Andrei? This is not a compiler issue - it is a phobos issue. Phobos did not provide a body for the function, so its address couldn't be taken. The argument that this should be in the dmd test suite and import phobos is a load of garbage. |
|
Phobos and the compiler need to work together to make this work. |
|
You should have a look at what I changed to make this work. Nothing to do with the compiler's handling of intrinsics. |
|
The point of this test is to ensure that the fix, whatever it was, remains working. |
|
It is testing that a phobos function can be used in a certain way - the test belongs in phobos. From the compiler's perspective this is just a normal function. |
…elease mode
Seems to work, adding a test case to ensure it.