Bug 2578 – Compiler crashes when type is passed to writefln()

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-01-10T20:48:00Z
Last change time
2015-06-09T01:21:00Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
snake.scaly

Comments

Comment #0 by snake.scaly — 2009-01-10T20:48:55Z
To reproduce, compile this: import std.stdio; struct Foo {} void main() { writefln(Foo); } The DMD crashes with access violation (read address 0x00000000)
Comment #1 by clugdbug — 2009-04-03T01:58:05Z
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