Skip to content

Commit

Permalink
Merge pull request #902 from quickfur/issue8021
Browse files Browse the repository at this point in the history
Throw exception upon division by zero. (issue 8021)
  • Loading branch information
Alex Rønne Petersen committed Nov 1, 2012
2 parents ec98d0f + 47c7ade commit c7a8dbe
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions std/bigint.d
Expand Up @@ -493,9 +493,8 @@ private:
// Generate a runtime error if division by zero occurs
void checkDivByZero() pure const
{
assert(!isZero(), "BigInt division by zero");
if (isZero())
auto x = 1/toInt(); // generate a div by zero error
throw new Error("BigInt division by zero");
}
}

Expand Down

0 comments on commit c7a8dbe

Please sign in to comment.