[Issue 6993] New: File.byLine runs on an empty file, fails enforcement

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 22 21:05:47 PST 2011


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

           Summary: File.byLine runs on an empty file, fails enforcement
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2011-11-22 21:04:53 PST ---
Create a new file "empty.d" and run this:

import std.stdio;

void main()
{
    auto file = File("empty.d", "r");
    foreach (aLine; file.byLine)
    {
    }
}

object.Exception at D:\DMD\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(943):
Enforcement failed

Line 943:
enforce(file.isOpen);

So the file was not successfully opened, but why wasn't an exception thrown in
the File constructor then?

-- 
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