On Mon, 09 Jan 2012 22:33:28 +0100, Juan Campanas <joh...@bells.com> wrote:

On Monday, 9 January 2012 at 21:14:05 UTC, Robert Clipsham wrote:
Are exceptions in safe D possible? I started trying to make my code @safe (there's no reason why it can't be as far as I'm aware), but I hit the following issue:

----
@safe

class MyException : Exception
{
   this()
   {
       super("");
   }
}

void main()
{
   throw new MyException("");
}
----
$ rdmd test.d
test.d(7): Error: safe function 'this' cannot call system function 'this' test.d(13): Error: constructor test.MyException.this () is not callable using argument types (string) test.d(13): Error: expected 0 arguments, not 1 for non-variadic function type @safe MyException()
----

Is this just unimplemented, is there a workaround, or will this never work?

Thanks,

Why are you calling the MyException constructor with a string parameter?

Yeah, that explains the error on line 13.


Anyways. I think that Exception is not marked as @safe.

Indeed. This seems like a bug. Please file it in bugzilla.
http://d.puremagic.com/issues/enter_bug.cgi

Reply via email to