[Issue 5447] Should be illegal to throw a non-Throwable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 13 07:49:40 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5447



--- Comment #2 from Don <clugdbug at yahoo.com.au> 2011-01-13 07:47:51 PST ---
(In reply to comment #1)

> Index: statement.c
> ===================================================================
> --- statement.c    (revision 871)
> +++ statement.c    (working copy)
> @@ -4435,8 +4435,9 @@
>  #endif
>      exp = exp->semantic(sc);
>      exp = resolveProperties(sc, exp);
> -    if (!exp->type->toBasetype()->isClassHandle())
> -        error("can only throw class objects, not type %s",
> exp->type->toChars());
> +    ClassDeclaration *cd = exp->type->toBasetype()->isClassHandle();
> +    if (!cd || ((cd != ClassDeclaration::throwable) &&
> !ClassDeclaration::throwable->isBaseOf(cd, NULL)))
> +        fd->error("can only throw class objects derived from Throwable, not
> type %s", exp->type->toChars());
>      return this;
>  }

Sorry, the fd->error(...)
should be  error(...)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list