digitalmars.D.bugs - [Issue 310] New: Code compiled by dmd dies without explanation / exception. Code is attached.
- d-bugmail puremagic.com Aug 24 2006
- d-bugmail puremagic.com Jun 25 2008
- d-bugmail puremagic.com Sep 23 2009
http://d.puremagic.com/issues/show_bug.cgi?id=310 Summary: Code compiled by dmd dies without explanation / exception. Code is attached. Product: D Version: 0.163 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: tbolsh gmail.com I found that when I was defining a bug 309. Here is the code: import std.boxer; import std.stdio; interface A { public char[] message(); } class B : A { char []info; this(char []info){ this.info = info; } public char[] toString(){ return info; } public char[] message(){ return toString(); } } void main(char [][]args){ A aa = new B( "I am A" ); B bb = new B( "I am A too!"); Box a = box( aa ), b = box( bb ); if( unboxable!(A)( a ) ) writefln( "a is A! It says: "~a.toString() ); else writefln( "a is not A! Despite it says: "~a.toString() ); if( unboxable!(A)( b ) ) writefln( "b is A! It says: "~b.toString() ); else writefln( "b is not A! Despite it says: "~b.toString() ); } Here is command lines:dmd -I/usr/local/dmd/src/phobos TestBoxError.d std/boxer.d
Process dmd exited with code 0./TestBoxError
The reason is that interface A does not has toString() defined ? The bug is connected with 309, I think. It is not severe - workaround is obvious - especially taking in consideration 309. GDC behaves differently:gdc -I/usr/local/dmd/src/phobos TestBoxError.d std/boxer.d
delegate(dchar),TypeInfo[],char*,void*) does not match argument types (void delegate(dchar),TypeInfo[2],void[]) std/boxer.d:279: cannot implicitly convert expression (args) of type void[] to char* Process gdc exited with code 1 But:gdc -I/usr/local/dmd/src/phobos TestBoxError.d
./a.out
What is confusing as well. The bug is REALLY confusing, especially for Java programmers, because we know well, that EVERY object has toString. I think that this bug can be relevant to std.format.doFormat or to the way how dmd handles interfaces. --
Aug 24 2006
http://d.puremagic.com/issues/show_bug.cgi?id=310 ------- Comment #1 from bugzilla digitalmars.com 2008-06-25 04:32 ------- If main() returns a void, as it does in the example, it will have garbage for the exit code, which is what you're seeing. --
Jun 25 2008
http://d.puremagic.com/issues/show_bug.cgi?id=310 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |clugdbug yahoo.com.au Resolution| |FIXED --- Comment #2 from Don <clugdbug yahoo.com.au> 2009-09-23 07:37:02 PDT --- This was fixed in 0.175 or earlier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 23 2009









d-bugmail puremagic.com 