Fix std.exception.ifThrown tests in release mode.

As the unit test is not @safe, bounds checking is disabled
when building with -release.

This is a backport of D-Programming-Language/phobos#1352.