www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18322] New: void fun(string file=__FILE_FULL_PATH__)()


          Issue ID: 18322
           Summary: void fun(string file=__FILE_FULL_PATH__)() returns
                    relative path (pointing to nowhere)
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

this is reminiscent of https://issues.dlang.org/show_bug.cgi?id=16640 but
different, and in fact worse since it returns a wrong relative path

dmd -Ifoo4 -run main.d
foo4/main.d #BUG: relative path pointing to nowhere
/path/to/main.d #OK: absolute path


// main.d:
module main;
import util;
void main(){fun;}

// foo4/main.d:
module util;
void fun(string file1=__FILE_FULL_PATH__)(string file2=__FILE_FULL_PATH__){
  import std.stdio;
  writeln(file1); // BUG:relative path
  writeln(file2); // OK

NOTE: calling it a regression because dmd 2.075 also returned a relative path
instead of absolute (which is wrong) but at least the relative path it returned
was correct instead of pointing to nowhere

Jan 28 2018