module main;

import std.stdio, std.file, std.string, std.algorithm, std.range, std.datetime, std.conv, std.typetuple;

int f(string fileName = r"C:\Euler\data\e67.txt") {
   auto text = read(fileName);
   return text.length;
}

void main()
{
  try {
      string fileName = r"C:\Euler\data\e67.txt";
      auto text = read(fileName);
      writeln(text.length);

      writeln(f);  // **** EXCEPTION HERE
   }
   catch (Exception e) {
      writeln(e);
   }

   writeln(f);
}

I'm running this test code compiled with DMD 2.063.2 on Windows 7 and I'm getting an exception "The system cannot find the file specified". The same code runs fine on Linux. The file in question exists of course.

When I remove the default parameter value from f(), exceptions stop. Is there a problem of having two strings r"C:\Euler\data\e67.txt" with the same content?

Reply via email to