Could assertThrown be made safe/trusted?

Jonathan M Davis jmdavisProg at gmx.com
Tue Jan 17 09:07:05 PST 2012


On Tuesday, January 17, 2012 15:27:04 simendsjo wrote:
> At the top of the module:
> @safe:
> 
> later
> unittest {
>    assertThrown(...)
> }
> 
> Ooops. AssertThrown not safe.
> 
> Changing the top to:
> version(Unittest) {}
> else { @safe: }
> 
> makes it work, but then I'll need to use that idom in all safe modules
> as assert*Thrown is handly methods.

Exception itself isn't @safe yet (its constructor in particular), and I don't 
think that AssertError is either. A number of stuff like that in druntime and 
Phobos still needs to be marked @safe or @trusted.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list