alias to fully qualified symbol gives error, but when module is also a symbol

Dennis dkorpel at gmail.com
Sun May 5 15:22:31 UTC 2019


I was trying to rename an imported `sqrt` (wrongly), but I 
stumbled upon this weird behavior:
```
void main() {
     import core.stdc.math: sqrtf, sqrt;
     alias sqrtd = core.stdc.math.sqrt;
     auto a = sqrtd(1);
}
```
onlineapp.d(3): Error: undefined identifier core.stdc.math.sqrt

However, when std.stdio is imported:

```
void main() {
     import std.stdio;
     import core.stdc.math: sqrtf, sqrt;
     alias sqrtd = core.stdc.math.sqrt;
     auto a = sqrtd(1);
}
```
onlineapp.d(4): Deprecation: std.stdio.core is not visible from 
module onlineapp
onlineapp.d(4): Deprecation: std.stdio.core is not visible from 
module onlineapp

Apart from the deprecation, it actually works. What is the 
intended behavior here? Is this a new issue, or does the 
deprecation already cover it once it becomes an error?

(Btw the correct way to do this is `import core.stdc.math: sqrtf, 
sqrtd = sqrt;`)


More information about the Digitalmars-d-learn mailing list