[Issue 16640] void fun(string file=__FILE_FULL_PATH__) returns relative path
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Jan 9 08:52:57 PST 2017
https://issues.dlang.org/show_bug.cgi?id=16640
--- Comment #3 from Jonathan Marler <johnnymarler at gmail.com> ---
The __FILE_FULL_PATH__ macro is a feature that I added to the DMD compiler in
the commit you referenced (67d08406f7451954cd8caf5faea6a2a87244f8e7). I never
tested using it as a default argument to a function parameter so it looks like
you've found a bug. You are welcome to fix this. If you decide to fix it, I
would also add a unit test. The original unit test I added for this feature is
in <dmd>/test/compilable/line.d, it may or may not be the correct place for the
new unit test, but it should definitely be added somewhere. Maybe a test like
this:
void testFileFullPathAsDefaultArgument(string preBakedFileFullPath, string
fileFullPath = __FILE_FULL_PATH__)
{
assert(preBakedFileFullPath == fileFullPath);
}
testFileFullPathAsDefaultArgument(__FILE_FULL_PATH__);
Let me know if you have any questions.
P.S. Just out of curiosity, what were you using this macro for? I spent alot
of time convincing the D maintainers that it was a useful feature so I'm
curious what uses people have found for it.
--
More information about the Digitalmars-d-bugs
mailing list