digitalmars.D.bugs - [Issue 6789] New: std.stdio.File + ternary = bug
- d-bugmail puremagic.com (27/27) Oct 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6789
- d-bugmail puremagic.com (23/23) Apr 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=6789
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 puremagic.com
ReportedBy: dsimcha yahoo.com
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: -------
Oct 07 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6789
SomeDude <lovelydear mailmetrash.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lovelydear mailmetrash.com
PDT ---
This is not a bug. The test actually works if the file "test.d" exists
beforehand.
If it doesn't exist, one must open the file in write mode. By default, the file
is open in read mode.
This works as intended.
import std.stdio;
void main() {
bool foo;
auto lines = (foo ? File("test.d", "w") : File("test.d", "w")).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: -------
Apr 23 2012








d-bugmail puremagic.com