[Issue 18911] New: __FILE_FULL_PATH__ is wrong in imported module
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun May 27 09:30:39 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=18911
          Issue ID: 18911
           Summary: __FILE_FULL_PATH__ is wrong in imported module
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: johanengelen at weka.io
In a module that is imported after being found by the import path on the
cmdline, __FILE_FULL_PATH__ is wrong, e.g. it is:
"/Users/johan/bla/bla/include//Users/johan/bla/bla/bla/" (somehow duplicating
part of the path).
Testcase:
```
// File: fullfilepath.d
import a;
enum THIS_FILE = __FILE_FULL_PATH__;
enum suffix_this = "fullfilepath.d";
static assert(THIS_FILE[0..$-suffix_this.length] ==
A_FILE[0..$-suffix_a.length]);
```
```
// File: include/a.d
enum A_FILE = __FILE_FULL_PATH__;
enum suffix_a = "include/a.d";
```
Compilation fails both with relative include path:
```
dmd -c -Iinclude fullfilepath.d
```
and with absolute include path:
```
dmd -c -I/your/absolute/path/include fullfilepath.d
```
This was fixed in DMD 2.079.
But there is no testcase for it, so opening this bug report and submitting a PR
with testcase soon after.
--
    
    
More information about the Digitalmars-d-bugs
mailing list