Using `__FILE__.ptr` will get const-folded, meaning it will always be the caller's site showing up: ``` // a.d import b; void main () { foo(); } ``` ``` // b.d import core.stdc.stdio; void foo(const(char)* file = __FILE__.ptr) { printf("Called from %s\n", file); } ``` Using the latest DMD (v2.093.1): ``` $ dmd -i -run a.d Called from b.d ``` But why would one ever use `__FILE__.ptr`, might you ask ? Just use `__FILE__` ! Well I would, but in my original code, `foo` is `extern(C++)`...
Side note: `__FUNCTION__` and `__PRETTY_FUNCTION__` work correctly.
*** This issue has been marked as a duplicate of issue 18919 ***