[Issue 17441] std.traits.moduleName gives wrong answer for modules imported under a different name in a mixin
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 10 14:45:28 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=17441
--- Comment #2 from berni44 <bugzilla at d-ecke.de> ---
The problem is the call to packageName, not moduleName:
void main()
{
import std.traits : packageName;
import mod0 = foo.bar.baz;
import mod1 = foo.bar;
assert(packageName!mod0 == "foo.bar"); // comment this line out and it
works
assert(packageName!mod1 == "foo"); // fails with foo.bar
}
It seems, that the template `packageName` is only instantiated with the first
call. For the second, the template parameter seems to be considered the same as
before (although it isn't). DMD bug?
--
More information about the Digitalmars-d-bugs
mailing list