[Issue 7659] std.stdio.File.close() erases file.name

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 21 18:39:15 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7659



--- Comment #4 from 1100110 <10equals2 at gmail.com> 2012-06-21 18:41:39 PDT ---
I encountered this bug, or a similar variant.

I can't decide if I just won the lottery, or if it's reproducable...
I couldn't reproduce it, but I might be missing something important.
All of my attempts simply segfaulted.

This code immediately exits the function with no errors.
It returns the correct value even though I assume the return statement is never
reached since nothing around the return statement will execute.
try
{
  auto f = File(fileName, "w");
  f.write("success");
  f.detach;
  if(true)
  {
     f = File(fileName, "r");
     if(startsWith(f.readln(), "success"))
         success = true;
  }
  f.close;
///All of these cause it to immediately exit the current func.
  f.name;
  writeln(f.name);
  f.name.remove;
}

The catch statement also catches no Exceptions.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list