www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2709] New: foreach with undefined identifier segfaults dmd

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2709

           Summary: foreach with undefined identifier segfaults dmd
           Product: D
           Version: 2.025
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: georg iki.fi


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.


-- 
Mar 05 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2709







 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.
 
--
Mar 05 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2709


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE







*** This bug has been marked as a duplicate of 2577 ***


-- 
Mar 05 2009