digitalmars.D - Error in object.d
- Alexander Panek (30/30) Apr 01 2005 Hello,
- bobef (5/35) Apr 01 2005 I had similar problem when named a file object.d. It did't even contain ...
- Alexander Panek (7/12) Apr 01 2005 I think you misunderstood something; I found this "mistake" inside the
- Ben Hinkle (8/32) Apr 01 2005 eek. If you want to throw an Exception that doesn't have an error messag...
- Regan Heath (9/42) Apr 01 2005 I believe your error is caused by the implicit "super" call added to you...
- Georg Wrede (3/5) Apr 02 2005 I think requiring a diagnostic message in the exception instance a Good
- Regan Heath (11/16) Apr 02 2005 You're probably right. In which case I think the real problem encountere...
Hello, I get this weird error... Y:\Programming\D\XML\src>%dmd% xml.d c:\dmd\bin\..\src\phobos\object.d(92): constructor object.Exception.this (char[]) does not match argument types () Error: expected 1 arguments, not 0 ...when trying to compile... public class XmlError : Exception { this(char[] msg) { writefln(msg); } } ...so I solved the problem by adding "this();" at line 91... class Exception : Object { char[] msg; this(); // <----------- *********** HERE *********** this(char[] msg); void print(); char[] toString(); } ...and the compiletime-error went away. I don`t know if anybody had this error before, but I`ve never read about something like that in the newsgroup yet. Just wanted to point out that :). Regards, Alex -- huh? did you say something? :o
Apr 01 2005
I had similar problem when named a file object.d. It did't even contain class named object but looks like dmd doesn't like files/classes with same names as phobos or something... In article <opsokjqktty2yy8c chello080109082145.3.15.vie.surfer.at>, Alexander Panek says...Hello, I get this weird error... Y:\Programming\D\XML\src>%dmd% xml.d c:\dmd\bin\..\src\phobos\object.d(92): constructor object.Exception.this (char[]) does not match argument types () Error: expected 1 arguments, not 0 ...when trying to compile... public class XmlError : Exception { this(char[] msg) { writefln(msg); } } ...so I solved the problem by adding "this();" at line 91... class Exception : Object { char[] msg; this(); // <----------- *********** HERE *********** this(char[] msg); void print(); char[] toString(); } ...and the compiletime-error went away. I don`t know if anybody had this error before, but I`ve never read about something like that in the newsgroup yet. Just wanted to point out that :). Regards, Alex -- huh? did you say something? :o
Apr 01 2005
On Fri, 1 Apr 2005 20:26:31 +0000 (UTC), bobef <bobef_member pathlink.com> wrote:I had similar problem when named a file object.d. It did't even contain class named object but looks like dmd doesn't like files/classes with same names as phobos or something...I think you misunderstood something; I found this "mistake" inside the object.d of *phobos*. Alex -- huh? did you say something? :o
Apr 01 2005
"Alexander Panek" <alexander.panek brainsware.org> wrote in message news:opsokjqktty2yy8c chello080109082145.3.15.vie.surfer.at...Hello, I get this weird error... Y:\Programming\D\XML\src>%dmd% xml.d c:\dmd\bin\..\src\phobos\object.d(92): constructor object.Exception.this (char[]) does not match argument types () Error: expected 1 arguments, not 0 ...when trying to compile... public class XmlError : Exception { this(char[] msg) { writefln(msg); } } ...so I solved the problem by adding "this();" at line 91...eek. If you want to throw an Exception that doesn't have an error message then you should subclass Object and not Exception. Note that it looks like a bug that you pass a message to the ctor of the XmlError and it *immediately* prints the message instead of passing it to the Exception ctor.class Exception : Object { char[] msg; this(); // <----------- *********** HERE *********** this(char[] msg); void print(); char[] toString(); } ...and the compiletime-error went away.Presumably replaced with a linking error when you tried to use a ctor that doesn't exist?Or did you rebuild phobos?
Apr 01 2005
On Fri, 01 Apr 2005 21:43:22 +0200, Alexander Panek <alexander.panek brainsware.org> wrote:Hello, I get this weird error... Y:\Programming\D\XML\src>%dmd% xml.d c:\dmd\bin\..\src\phobos\object.d(92): constructor object.Exception.this (char[]) does not match argument types () Error: expected 1 arguments, not 0 ...when trying to compile... public class XmlError : Exception { this(char[] msg) { writefln(msg); } } ...so I solved the problem by adding "this();" at line 91... class Exception : Object { char[] msg; this(); // <----------- *********** HERE *********** this(char[] msg); void print(); char[] toString(); } ...and the compiletime-error went away. I don`t know if anybody had this error before, but I`ve never read about something like that in the newsgroup yet. Just wanted to point out that :).I believe your error is caused by the implicit "super" call added to your "this" in your XmlError. I believe the correct soution is:public class XmlError : Exception { this(char[] msg) {super(msg);writefln(msg); } }Exception does not have a "this()" taking no parameter, perhaps it should, perhaps it shouldn't, I am undecided. Regan
Apr 01 2005
Regan Heath wrote:Exception does not have a "this()" taking no parameter, perhaps it should, perhaps it shouldn't, I am undecided.I think requiring a diagnostic message in the exception instance a Good Thing.
Apr 02 2005
On Sat, 02 Apr 2005 16:15:11 +0300, Georg Wrede <georg.wrede nospam.org> wrote:Regan Heath wrote:You're probably right. In which case I think the real problem encountered here is the error message: "c:\dmd\bin\..\src\phobos\object.d(92): constructor object.Exception.this (char[]) does not match argument types () Error: expected 1 arguments, not 0" This error is 'suggesting' the class is at fault when it's actually the 'implicit' 'super' call to the constructor which needs fixing. I'll post this to the bugs NG. ReganException does not have a "this()" taking no parameter, perhaps it should, perhaps it shouldn't, I am undecided.I think requiring a diagnostic message in the exception instance a Good Thing.
Apr 02 2005