Bug 2715 – Access Violation at writefln with interface

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-03-08T01:09:00Z
Last change time
2015-06-09T05:14:59Z
Keywords
ice-on-valid-code, patch
Assigned to
bugzilla
Creator
rayerd.wiz

Attachments

IDFilenameSummaryContent-TypeSize
2962715_nothrow-crash.diffFix e1->type when clearing this->type within CallExp.text/plain520
2982715_nothrow-crash.diffFix e1->type when clearing this->type within CallExp (corrected.)text/plain428

Comments

Comment #0 by rayerd.wiz — 2009-03-08T01:09:52Z
import std.stdio; interface A {} void main() { A x; writefln(x); } C:\D\dmd\windows\bin\..\..\src\phobos\std\format.d(2050): Error: no property 'toString' for type 'a.A' C:\D\dmd\windows\bin\..\..\src\phobos\std\format.d(2051): template std.stdio.PrivateFileWriter!(char).PrivateFileWriter.write(C) does not match any function template declaration C:\D\dmd\windows\bin\..\..\src\phobos\std\format.d(2051): template std.stdio.PrivateFileWriter!(char).PrivateFileWriter.write(C) cannot deduce template function from argument types !()(int) <-- dmd died here!
Comment #1 by bugs-d — 2009-03-28T23:53:53Z
Created attachment 296 Fix e1->type when clearing this->type within CallExp. This is crashing within CallExp::canThrow(), since e1->type is NULL. I assume checkSideAffect() might have this happen too. As I read the code, e1->type hasn't been properly set yet where I've patched. Since we don't have f anyway, I think Type::terror is the right thing to set it to. This does fix the crash, and doesn't spit out any confusing error messages (other than before.) I am concerned there may be other places (other Expression's canThrow/etc.?) that have this same issue. My understanding of the code is probably to limited to evaluate that. -[Unknown]
Comment #2 by bugs-d — 2009-03-29T01:50:46Z
Created attachment 298 Fix e1->type when clearing this->type within CallExp (corrected.) I screwed this patch up, sorry about that. I used a batch script and forgot to kill echo in it. This version is the same as above but a valid diff file. -[Unknown]
Comment #3 by bugzilla — 2009-05-02T10:04:03Z
Works dmd 2.029 and 1.042