January 14, 2011 [dmd-internals] dmd commit, revision 873 | ||||
---|---|---|---|---|
| ||||
dmd commit, revision 873 user: walter msg: bugzilla 5447 Should be illegal to throw a non-Throwable http://www.dsource.org/projects/dmd/changeset/873 paths changed: U trunk/src/aggregate.h U trunk/src/class.c U trunk/src/statement.c |
January 14, 2011 [dmd-internals] dmd commit, revision 873 | ||||
---|---|---|---|---|
| ||||
Posted in reply to dsource.org | Thanks! Cleans up a lot of code. For completeness, we should disallow catching non-Throwables. This little change to Catch::semantic in statement.c line 4216: - if (!type->toBasetype()->isClassHandle()) + ClassDeclaration *cd = type->toBasetype()->isClassHandle(); + if (!cd || ((cd != ClassDeclaration::throwable) && !ClassDeclaration::throwable->isBaseOf(cd, NULL))) { if (type != Type::terror) - { error(loc, "can only catch class objects, not '%s'", type->toChars()); + { error(loc, "can only catch objects derived from Throwable, not '%s'", type->toChars()); type = Type::terror; } } > dmd commit, revision 873 > user: walter > > msg: > bugzilla 5447 Should be illegal to throw a non-Throwable |
Copyright © 1999-2021 by the D Language Foundation