www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2578] New: Compiler crashes when type is passed to writefln()

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

           Summary: Compiler crashes when type is passed to writefln()
           Product: D
           Version: 2.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: snake.scaly gmail.com


To reproduce, compile this:

import std.stdio;
struct Foo {}
void main()
{
    writefln(Foo);
}

The DMD crashes with access violation (read address 0x00000000)


-- 
Jan 10 2009
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2578


clugdbug yahoo.com.au changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME





Works for me, Windows DMD 1.042 and DMD2.027.
DMD2.027 doesn't refer to the source file which contained the error, but I
think that's normal behaviour and a quite different Phobos issue (Phobos
doesn't accept structs without toString().

c:\dmd\windows\bin\..\..\src\phobos\std\format.d(2050): Error: no property
'toSt
ring' for type 'Foo'
c:\dmd\windows\bin\..\..\src\phobos\std\format.d(2051): Error: template
std.stdi
o.PrivateFileWriter!(char).PrivateFileWriter.write(C) does not match any
functio
n template declaration
c:\dmd\windows\bin\..\..\src\phobos\std\format.d(2051): Error: template
std.stdi
o.PrivateFileWriter!(char).PrivateFileWriter.write(C) cannot deduce template
fun
ction from argument types !()(int)
c:\dmd\windows\bin\..\..\src\phobos\std\format.d(2133): Error: template
instance
 std.format.formatGeneric!(PrivateFileWriter!(char),Foo) error instantiating


-- 
Apr 02 2009