Bug 2709 – foreach with undefined identifier segfaults dmd

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-03-05T08:17:00Z
Last change time
2015-06-09T01:21:08Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
georg

Comments

Comment #0 by georg — 2009-03-05T08:17:07Z
void main(string[] args) { foreach (line; stdin.byLine()) { printf(line,i); } } Segfaults the compiler. Output is: dmd segtest.d segtest.d(3): Error: undefined identifier stdin segtest.d(3): Error: undefined identifier stdin segtest.d(3): Error: no property 'byLine' for type 'int' segtest.d(3): Error: function expected before (), not 1 of type int segtest.d(3): Error: foreach: int is not an aggregate type Segmentation fault Tested with both 2.025 and 2.026.
Comment #1 by georg — 2009-03-05T08:28:43Z
(In reply to comment #0) > void main(string[] args) > { > foreach (line; stdin.byLine()) > { printf(); // Same output as original post. > } > } > > Segfaults the compiler. Output is: > > dmd segtest.d > segtest.d(3): Error: undefined identifier stdin > segtest.d(3): Error: undefined identifier stdin > segtest.d(3): Error: no property 'byLine' for type 'int' > segtest.d(3): Error: function expected before (), not 1 of type int > segtest.d(3): Error: foreach: int is not an aggregate type > Segmentation fault > > Tested with both 2.025 and 2.026. >
Comment #2 by smjg — 2009-03-05T19:55:40Z
*** This bug has been marked as a duplicate of 2577 ***