Bug 504 – foreach with a file failes

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-11-14T06:52:09Z
Last change time
2020-09-02T07:09:25Z
Assigned to
Walter Bright
Creator
Stefan Liebig

Comments

Comment #0 by StefanLiebig — 2006-11-14T06:52:09Z
The following code (counting lines of given file) fails (Error: Access Violation) with 0.173 but works fine with 0.172: import std.stdio; import std.stream; int main(char[][] args) { BufferedFile inFile = new BufferedFile(); try { inFile.open( args[ 1 ], FileMode.In ) ; // count the lines int max; foreach ( ulong n, char[] line; inFile ) { max = n; } printf( "%d", max ); } finally { inFile.close(); } return 0; }
Comment #1 by StefanLiebig — 2006-11-15T00:21:18Z
The problem does no longer appear with 0.174.
Comment #2 by matti.niemenmaa+dbugzilla — 2006-11-15T02:39:04Z
I suppose the bug report can go, then.
Comment #3 by dlang-bot — 2020-09-02T07:09:25Z
dlang-community/dfmt pull request #505 "Keep line break after function attributes" was merged into master: - e6e52cd4d13b77368fef1a78f7ae451a6fcc543e by Eugen Wissner: Keep line break after function attributes Fixes #504. https://github.com/dlang-community/dfmt/pull/505