[dmd-internals] dmd commit, revision 873

Don Clugston dclugston at googlemail.com
Fri Jan 14 02:52:57 PST 2011


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


More information about the dmd-internals mailing list