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: nob...@puremagic.com
        ReportedBy: dsim...@yahoo.com


--- Comment #0 from David Simcha <dsim...@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: -------

Reply via email to