On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote:
file test.d:
-------------
module test;
import abc;
void doTest(){
log!"test"();
}
-----------
file abc.d:
-------------
module abc;
import test;
void log(string fmt, int line = __LINE__, string path =
__FILE__[0..$], A...)(A a) {
import core.stdc.stdio;
printf("[%s:%d] \n", path.ptr, line);
}
extern(C) int main() {
doTest();
return 0;
}
-------------
retult: [abc.d:4]
expect: [test.d:4]
It's a known bug: https://issues.dlang.org/show_bug.cgi?id=18919
If you remove the slicing from `__FILE__`, it'll work as expected.