Fix e1->type when clearing this->type within CallExp (corrected.)
text/plain
428
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]