Exceptions in safe D
Robert Clipsham
robert at octarineparrot.com
Mon Jan 9 13:14:04 PST 2012
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,
--
Robert
http://octarineparrot.com/
More information about the Digitalmars-d-learn
mailing list