[Issue 6789] New: std.stdio.File + ternary = bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 7 16:48:49 PDT 2011


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

           Summary: std.stdio.File + ternary = bug
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-10-07 16:48:04 PDT ---
I haven't been able to reduce this far enough to know for sure whether this is
a DMD or Phobos bug, but the following ternary operator expression should work:

import std.stdio;

void main() {
    bool foo;
    auto lines = (foo ? File("test.d") : File("test.d")).byLine();
    writeln(lines.empty);  // true

    auto handle = File("test.d");
    lines = handle.byLine();
    writeln(lines.empty);  // false
}

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