Exceptions in safe D
simen.kjaras at gmail.com
Mon Jan 9 14:56:53 PST 2012
On Mon, 09 Jan 2012 22:33:28 +0100, Juan Campanas <johnny at 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:
>> class MyException : Exception
>> void main()
>> throw new MyException("");
>> $ rdmd test.d
>> test.d(7): Error: safe function 'this' cannot call system function
>> 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
> 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.
More information about the Digitalmars-d-learn