[Issue 6789] std.stdio.File + ternary = bug
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 23 03:57:17 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6789
SomeDude <lovelydear at mailmetrash.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |lovelydear at mailmetrash.com
--- Comment #1 from SomeDude <lovelydear at mailmetrash.com> 2012-04-23 03:58:17 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: -------
More information about the Digitalmars-d-bugs
mailing list